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/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/nfsserver164
7 files changed, 303 insertions, 0 deletions
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 0000000000..613ddc003a
--- /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 0000000000..147d7a7b5f
--- /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 0000000000..746dacf056
--- /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 0000000000..c3442380e1
--- /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 0000000000..d8f8181670
--- /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 0000000000..a1007a7fbf
--- /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/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
new file mode 100644
index 0000000000..1ac6fec023
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -0,0 +1,164 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: nfs-kernel-server
4# Required-Start: $remote_fs $portmap hwclock
5# Required-Stop: $remote_fs $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
27test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
28#
29# The user mode program must also exist (it just starts the kernel
30# threads using the kernel module code).
31test -x "$NFS_MOUNTD" || exit 0
32test -x "$NFS_NFSD" || exit 0
33#
34# Default is 8 threads, value is settable between 1 and the truely
35# ridiculous 99
36test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8
37#
38# The default state directory is /var/lib/nfs
39test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
40#
41#----------------------------------------------------------------------
42# Startup and shutdown functions.
43# Actual startup/shutdown is at the end of this file.
44#directories
45create_directories(){
46 echo -n 'creating NFS state directory: '
47 mkdir -p "$NFS_STATEDIR"
48 ( cd "$NFS_STATEDIR"
49 umask 077
50 mkdir -p sm sm.bak
51 test -w sm/state || {
52 rm -f sm/state
53 :>sm/state
54 }
55 umask 022
56 for file in xtab etab smtab rmtab
57 do
58 test -w "$file" || {
59 rm -f "$file"
60 :>"$file"
61 }
62 done
63 )
64 echo done
65}
66#mountd
67start_mountd(){
68 echo -n 'starting mountd: '
69 start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
70 echo done
71}
72stop_mountd(){
73 echo -n 'stopping mountd: '
74 start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD"
75 echo done
76}
77#
78#nfsd
79start_nfsd(){
80 echo -n "starting $1 nfsd kernel threads: "
81 start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
82 echo done
83}
84delay_nfsd(){
85 for delay in 0 1 2 3 4 5 6 7 8 9
86 do
87 if pidof nfsd >/dev/null
88 then
89 echo -n .
90 sleep 1
91 else
92 return 0
93 fi
94 done
95 return 1
96}
97stop_nfsd(){
98 # WARNING: this kills any process with the executable
99 # name 'nfsd'.
100 echo -n 'stopping nfsd: '
101 start-stop-daemon --stop --quiet --signal 1 --name nfsd
102 if delay_nfsd || {
103 echo failed
104 echo ' using signal 9: '
105 start-stop-daemon --stop --quiet --signal 9 --name nfsd
106 delay_nfsd
107 }
108 then
109 echo done
110 else
111 echo failed
112 fi
113}
114
115#statd
116start_statd(){
117 echo -n "starting statd: "
118 start-stop-daemon --start --exec "$NFS_STATD"
119 echo done
120}
121stop_statd(){
122 # WARNING: this kills any process with the executable
123 # name 'statd'.
124 echo -n 'stopping statd: '
125 start-stop-daemon --stop --quiet --signal 1 --name statd
126 echo done
127}
128#----------------------------------------------------------------------
129#
130# supported options:
131# start
132# stop
133# reload: reloads the exports file
134# restart: stops and starts mountd
135#FIXME: need to create the /var/lib/nfs/... directories
136case "$1" in
137start) create_directories
138 start_nfsd "$NFS_SERVERS"
139 start_mountd
140 start_statd
141 test -r /etc/exports && exportfs -a;;
142stop) exportfs -ua
143 stop_statd
144 stop_mountd
145 stop_nfsd;;
146status)
147 status /usr/sbin/rpc.mountd
148 RETVAL=$?
149 status nfsd
150 rval=$?
151 [ $RETVAL -eq 0 ] && exit $rval
152 exit $RETVAL;;
153reload) test -r /etc/exports && exportfs -r;;
154restart)exportfs -ua
155 stop_mountd
156 stop_statd
157 # restart does not restart the kernel threads,
158 # only the user mode processes
159 start_mountd
160 start_statd
161 test -r /etc/exports && exportfs -a;;
162*) echo "Usage: $0 {start|stop|status|reload|restart}"
163 exit 1;;
164esac