summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils/nfs-utils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch43
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service11
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service18
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service12
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch27
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch36
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf35
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon90
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver129
9 files changed, 401 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch
new file mode 100644
index 0000000..7025fb5
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch
@@ -0,0 +1,43 @@
1From 9b84cff305866abd150cf1a4c6e7e5ebf8a7eb3a Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Fri, 15 Nov 2013 23:21:35 +0100
4Subject: [PATCH] configure: Allow to explicitly disable nfsidmap
5
6* keyutils availability is autodetected and builds aren't reproducible
7
8Upstream-Status: Pending
9
10Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
11---
12 configure.ac | 10 +++++++++-
13 1 file changed, 9 insertions(+), 1 deletion(-)
14
15diff --git a/configure.ac b/configure.ac
16index bf433d6..28a8f62 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -69,6 +69,12 @@ AC_ARG_ENABLE(nfsv4,
20 AC_SUBST(enable_nfsv4)
21 AM_CONDITIONAL(CONFIG_NFSV4, [test "$enable_nfsv4" = "yes"])
22
23+AC_ARG_ENABLE(nfsidmap,
24+ [AC_HELP_STRING([--enable-nfsidmap],
25+ [enable support for NFSv4 idmapper @<:@default=yes@:>@])],
26+ enable_nfsidmap=$enableval,
27+ enable_nfsidmap=yes)
28+
29 AC_ARG_ENABLE(nfsv41,
30 [AC_HELP_STRING([--enable-nfsv41],
31 [enable support for NFSv41 @<:@default=yes@:>@])],
32@@ -296,7 +302,7 @@ fi
33
34 dnl enable nfsidmap when its support by libnfsidmap
35 AM_CONDITIONAL(CONFIG_NFSDCLTRACK, [test "$enable_nfsdcltrack" = "yes" ])
36-AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyes"])
37+AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$enable_nfsidmap$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyesyes"])
38
39
40 if test "$knfsd_cv_glibc2" = no; then
41--
421.8.4.3
43
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service
new file mode 100644
index 0000000..613ddc0
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=NFS Mount Daemon
3After=rpcbind.service nfs-server.service
4Requires=rpcbind.service nfs-server.service
5
6[Service]
7EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
8ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS
9
10[Install]
11WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service
new file mode 100644
index 0000000..147d7a7
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service
@@ -0,0 +1,18 @@
1[Unit]
2Description=NFS Server
3Requires=rpcbind.service nfs-mountd.service
4After=rpcbind.service
5
6[Service]
7Type=oneshot
8EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
9ExecStartPre=@SBINDIR@/exportfs -r
10ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT
11ExecStop=@SBINDIR@/rpc.nfsd 0
12ExecStopPost=@SBINDIR@/exportfs -f
13ExecReload=@SBINDIR@/exportfs -r
14StandardError=syslog
15RemainAfterExit=yes
16
17[Install]
18WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service
new file mode 100644
index 0000000..746dacf
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=NFS file locking service
3After=rpcbind.service
4Requires=rpcbind.service
5Before=remote-fs-pre.target
6
7[Service]
8EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
9ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS
10
11[Install]
12WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch
new file mode 100644
index 0000000..c344238
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.0.6-uclibc.patch
@@ -0,0 +1,27 @@
1Signed-off-by: Khem Raj <raj.khem@gmail.com>
2
3Upstream-Status: Inappropriate [embedded specific]
4
5Index: nfs-utils-1.2.6/support/nfs/svc_socket.c
6===================================================================
7--- nfs-utils-1.2.6.orig/support/nfs/svc_socket.c 2012-05-14 07:40:52.000000000 -0700
8+++ nfs-utils-1.2.6/support/nfs/svc_socket.c 2012-10-28 02:42:50.179222457 -0700
9@@ -40,8 +40,9 @@
10 char rpcdata[1024], servdata[1024];
11 struct rpcent rpcbuf, *rpcp;
12 struct servent servbuf, *servp = NULL;
13- int ret;
14+ int ret = 0;
15
16+#ifndef __UCLIBC__ /* neither getrpcbynumber() nor getrpcbynumber_r() is SuSv3 */
17 ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata,
18 &rpcp);
19 if (ret == 0 && rpcp != NULL) {
20@@ -60,6 +61,7 @@
21 }
22 }
23 }
24+#endif /* __UCLIBC__ */
25
26 if (ret == 0 && servp != NULL)
27 return ntohs(servp->s_port);
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch
new file mode 100644
index 0000000..d8f8181
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch
@@ -0,0 +1,36 @@
1Fixes errors like
2sm-notify[1070]: DNS resolution of a.b.c.d..com failed; retrying later
3This error will occur anytime sm-notify is run before the network if fully up,
4which is happening more and more with parallel startup systems.
5The res_init() call is simple, safe, quick, and a patch to use it should be
6able to go upstream. Presumably the whole reason sm-notify tries several
7times is to wait for possible changes to the network configuration, but without
8calling res_init() it will never be aware of those changes
9
10Backported drom Fedora
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15
16diff -up nfs-utils-1.2.3/utils/statd/sm-notify.c.orig nfs-utils-1.2.3/utils/statd/sm-notify.c
17--- nfs-utils-1.2.3/utils/statd/sm-notify.c.orig 2010-09-28 08:24:16.000000000 -0400
18+++ nfs-utils-1.2.3/utils/statd/sm-notify.c 2010-10-15 16:44:43.487119601 -0400
19@@ -28,6 +28,9 @@
20 #include <netdb.h>
21 #include <errno.h>
22 #include <grp.h>
23+#include <netinet/in.h>
24+#include <arpa/nameser.h>
25+#include <resolv.h>
26
27 #include "sockaddr.h"
28 #include "xlog.h"
29@@ -84,6 +87,7 @@ smn_lookup(const char *name)
30 };
31 int error;
32
33+ res_init();
34 error = getaddrinfo(name, NULL, &hint, &ai);
35 if (error != 0) {
36 xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error));
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf
new file mode 100644
index 0000000..a1007a7
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf
@@ -0,0 +1,35 @@
1# Parameters to be passed to nfs-utils (clients & server) service files.
2#
3
4# Options to pass to rpc.nfsd.
5NFSD_OPTS=""
6
7# Number of servers to start up; the default is 8 servers.
8NFSD_COUNT=""
9
10# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd".
11PROCNFSD_MOUNTPOINT=""
12
13# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid".
14PROCNFSD_MOUNTOPTS=""
15
16# Options for rpc.mountd.
17# If you have a port-based firewall, you might want to set up
18# a fixed port here using the --port option.
19MOUNTD_OPTS=""
20
21# Parameters to be passed to nfs-common (nfs clients & server) init script.
22#
23
24# If you do not set values for the NEED_ options, they will be attempted
25# autodetected; this should be sufficient for most people. Valid alternatives
26# for the NEED_ options are "yes" and "no".
27
28# Do you want to start the statd daemon? It is not needed for NFSv4.
29NEED_STATD=""
30
31# Options to pass to rpc.statd.
32# N.B. statd normally runs on both client and server, and run-time
33# options should be specified accordingly.
34# STATD_OPTS="-p 32765 -o 32766"
35STATD_OPTS=""
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
new file mode 100644
index 0000000..65fdd1d
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
@@ -0,0 +1,90 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: nfs-common
4# Required-Start: $portmap hwclock
5# Required-Stop: $portmap hwclock
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: NFS support for both client and server
9# Description: NFS is a popular protocol for file sharing across
10# TCP/IP networks. This service provides various
11# support functions for NFS mounts.
12### END INIT INFO
13#
14# Startup script for nfs-utils
15#
16#
17# Location of executables:
18
19# Source function library.
20. /etc/init.d/functions
21
22test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
23test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
24#
25# The default state directory is /var/lib/nfs
26test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
27#
28#----------------------------------------------------------------------
29# Startup and shutdown functions.
30# Actual startup/shutdown is at the end of this file.
31#directories
32create_directories(){
33 echo -n 'creating NFS state directory: '
34 mkdir -p "$NFS_STATEDIR"
35 ( cd "$NFS_STATEDIR"
36 umask 077
37 mkdir -p rpc_pipefs
38 mkdir -p sm sm.bak statd
39 chown rpcuser:rpcuser sm sm.bak statd
40 test -w statd/state || {
41 rm -f statd/state
42 :>statd/state
43 }
44 umask 022
45 for file in xtab etab smtab rmtab
46 do
47 test -w "$file" || {
48 rm -f "$file"
49 :>"$file"
50 }
51 done
52 )
53 chown rpcuser:rpcuser "$NFS_STATEDIR"
54 echo done
55}
56
57#statd
58start_statd(){
59 echo -n "starting statd: "
60 start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
61 echo done
62}
63stop_statd(){
64 echo -n 'stopping statd: '
65 start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
66 echo done
67}
68#----------------------------------------------------------------------
69#
70# supported options:
71# start
72# stop
73# restart: stops and starts mountd
74#FIXME: need to create the /var/lib/nfs/... directories
75case "$1" in
76 start)
77 create_directories
78 start_statd;;
79 stop)
80 stop_statd;;
81 status)
82 status $NFS_STATD
83 exit $?;;
84 restart)
85 $0 stop
86 $0 start;;
87 *)
88 echo "Usage: $0 {start|stop|status|restart}"
89 exit 1;;
90esac
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
new file mode 100644
index 0000000..6e0df7e
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -0,0 +1,129 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: nfs-kernel-server
4# Required-Start: $remote_fs nfs-common $portmap hwclock
5# Required-Stop: $remote_fs nfs-common $portmap hwclock
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Kernel NFS server support
9# Description: NFS is a popular protocol for file sharing across
10# TCP/IP networks. This service provides NFS server
11# functionality, which is configured via the
12# /etc/exports file.
13### END INIT INFO
14#
15# Startup script for nfs-utils
16#
17# Source function library.
18. /etc/init.d/functions
19#
20# The environment variable NFS_SERVERS may be set in /etc/default/nfsd
21# Other control variables may be overridden here too
22test -r /etc/default/nfsd && . /etc/default/nfsd
23#
24# Location of executables:
25test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd
26test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd
27#
28# The user mode program must also exist (it just starts the kernel
29# threads using the kernel module code).
30test -x "$NFS_MOUNTD" || exit 0
31test -x "$NFS_NFSD" || exit 0
32#
33# Default is 8 threads, value is settable between 1 and the truely
34# ridiculous 99
35test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
36#
37#----------------------------------------------------------------------
38# Startup and shutdown functions.
39# Actual startup/shutdown is at the end of this file.
40#mountd
41start_mountd(){
42 echo -n 'starting mountd: '
43 start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
44 echo done
45}
46stop_mountd(){
47 echo -n 'stopping mountd: '
48 start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD"
49 echo done
50}
51#
52#nfsd
53start_nfsd(){
54 modprobe -q nfsd
55 grep -q nfsd /proc/filesystems || {
56 echo NFS daemon support not enabled in kernel
57 exit 1
58 }
59 grep -q nfsd /proc/mounts || mount -t nfsd nfsd /proc/fs/nfsd
60 grep -q nfsd /proc/mounts || {
61 echo nfsd filesystem could not be mounted at /proc/fs/nfsd
62 exit 1
63 }
64
65 echo -n "starting $1 nfsd kernel threads: "
66 start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
67 echo done
68}
69delay_nfsd(){
70 for delay in 0 1 2 3 4 5 6 7 8 9
71 do
72 if pidof nfsd >/dev/null
73 then
74 echo -n .
75 sleep 1
76 else
77 return 0
78 fi
79 done
80 return 1
81}
82stop_nfsd(){
83 # WARNING: this kills any process with the executable
84 # name 'nfsd'.
85 echo -n 'stopping nfsd: '
86 start-stop-daemon --stop --quiet --signal 1 --name nfsd
87 if delay_nfsd || {
88 echo failed
89 echo ' using signal 9: '
90 start-stop-daemon --stop --quiet --signal 9 --name nfsd
91 delay_nfsd
92 }
93 then
94 echo done
95 else
96 echo failed
97 fi
98}
99
100#----------------------------------------------------------------------
101#
102# supported options:
103# start
104# stop
105# reload: reloads the exports file
106# restart: stops and starts mountd
107#FIXME: need to create the /var/lib/nfs/... directories
108case "$1" in
109 start)
110 start_nfsd "$NFS_SERVERS"
111 start_mountd
112 test -r /etc/exports && exportfs -a;;
113 stop) exportfs -ua
114 stop_mountd
115 stop_nfsd;;
116 status)
117 status /usr/sbin/rpc.mountd
118 RETVAL=$?
119 status nfsd
120 rval=$?
121 [ $RETVAL -eq 0 ] && exit $rval
122 exit $RETVAL;;
123 reload) test -r /etc/exports && exportfs -r;;
124 restart)
125 $0 stop
126 $0 start;;
127 *) echo "Usage: $0 {start|stop|status|reload|restart}"
128 exit 1;;
129esac