diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils')
11 files changed, 511 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch new file mode 100644 index 000000000..7025fb555 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch @@ -0,0 +1,43 @@ +From 9b84cff305866abd150cf1a4c6e7e5ebf8a7eb3a Mon Sep 17 00:00:00 2001 +From: Martin Jansa <Martin.Jansa@gmail.com> +Date: Fri, 15 Nov 2013 23:21:35 +0100 +Subject: [PATCH] configure: Allow to explicitly disable nfsidmap + +* keyutils availability is autodetected and builds aren't reproducible + +Upstream-Status: Pending + +Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> +--- + configure.ac | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index bf433d6..28a8f62 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -69,6 +69,12 @@ AC_ARG_ENABLE(nfsv4, + AC_SUBST(enable_nfsv4) + AM_CONDITIONAL(CONFIG_NFSV4, [test "$enable_nfsv4" = "yes"]) + ++AC_ARG_ENABLE(nfsidmap, ++ [AC_HELP_STRING([--enable-nfsidmap], ++ [enable support for NFSv4 idmapper @<:@default=yes@:>@])], ++ enable_nfsidmap=$enableval, ++ enable_nfsidmap=yes) ++ + AC_ARG_ENABLE(nfsv41, + [AC_HELP_STRING([--enable-nfsv41], + [enable support for NFSv41 @<:@default=yes@:>@])], +@@ -296,7 +302,7 @@ fi + + dnl enable nfsidmap when its support by libnfsidmap + AM_CONDITIONAL(CONFIG_NFSDCLTRACK, [test "$enable_nfsdcltrack" = "yes" ]) +-AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyes"]) ++AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$enable_nfsidmap$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyesyes"]) + + + if test "$knfsd_cv_glibc2" = no; then +-- +1.8.4.3 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch new file mode 100644 index 000000000..de0b045c8 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch @@ -0,0 +1,113 @@ +Upstream-Status: Pending + +Subject: nfs-utils/statd: fix a segfault caused by improper usage of RPC interface + +There is a hack which uses the bottom-level RPC improperly as below +in the current statd implementation: +insert a socket in the svc_fdset without a corresponding transport handle +and passes the socket to the svc_getreqset subroutine, this usage causes +a segfault of statd on a huge amount of sm-notifications. + +Fix the issue by separating the non-RPC-server sock from RPC dispatcher. + +Signed-off-by: Shan Hai <shan.hai@windriver.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + utils/statd/rmtcall.c | 1 - + utils/statd/statd.c | 5 +++-- + utils/statd/statd.h | 2 +- + utils/statd/svc_run.c | 8 ++++++-- + 4 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c +index fd576d9..cde091b 100644 +--- a/utils/statd/rmtcall.c ++++ b/utils/statd/rmtcall.c +@@ -104,7 +104,6 @@ statd_get_socket(void) + if (sockfd < 0) + return -1; + +- FD_SET(sockfd, &SVC_FDSET); + return sockfd; + } + +diff --git a/utils/statd/statd.c b/utils/statd/statd.c +index 51a016e..e21a259 100644 +--- a/utils/statd/statd.c ++++ b/utils/statd/statd.c +@@ -247,6 +247,7 @@ int main (int argc, char **argv) + int port = 0, out_port = 0; + int nlm_udp = 0, nlm_tcp = 0; + struct rlimit rlim; ++ int notify_sockfd; + + int pipefds[2] = { -1, -1}; + char status; +@@ -473,7 +474,7 @@ int main (int argc, char **argv) + } + + /* Make sure we have a privilege port for calling into the kernel */ +- if (statd_get_socket() < 0) ++ if ((notify_sockfd = statd_get_socket()) < 0) + exit(1); + + /* If sm-notify didn't take all the state files, load +@@ -528,7 +529,7 @@ int main (int argc, char **argv) + * Handle incoming requests: SM_NOTIFY socket requests, as + * well as callbacks from lockd. + */ +- my_svc_run(); /* I rolled my own, Olaf made it better... */ ++ my_svc_run(notify_sockfd); /* I rolled my own, Olaf made it better... */ + + /* Only get here when simulating a crash so we should probably + * start sm-notify running again. As we have already dropped +diff --git a/utils/statd/statd.h b/utils/statd/statd.h +index a1d8035..231ac7e 100644 +--- a/utils/statd/statd.h ++++ b/utils/statd/statd.h +@@ -28,7 +28,7 @@ extern _Bool statd_present_address(const struct sockaddr *sap, char *buf, + __attribute__((__malloc__)) + extern char * statd_canonical_name(const char *hostname); + +-extern void my_svc_run(void); ++extern void my_svc_run(int); + extern void notify_hosts(void); + extern void shuffle_dirs(void); + extern int statd_get_socket(void); +diff --git a/utils/statd/svc_run.c b/utils/statd/svc_run.c +index d98ecee..28c1ad6 100644 +--- a/utils/statd/svc_run.c ++++ b/utils/statd/svc_run.c +@@ -78,7 +78,7 @@ my_svc_exit(void) + * The heart of the server. A crib from libc for the most part... + */ + void +-my_svc_run(void) ++my_svc_run(int sockfd) + { + FD_SET_TYPE readfds; + int selret; +@@ -96,6 +96,8 @@ my_svc_run(void) + } + + readfds = SVC_FDSET; ++ /* Set notify sockfd for waiting for reply */ ++ FD_SET(sockfd, &readfds); + if (notify) { + struct timeval tv; + +@@ -125,8 +127,10 @@ my_svc_run(void) + + default: + selret -= process_reply(&readfds); +- if (selret) ++ if (selret) { ++ FD_CLR(sockfd, &readfds); + svc_getreqset(&readfds); ++ } + } + } + } +-- +1.9.1 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service new file mode 100644 index 000000000..613ddc003 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service @@ -0,0 +1,11 @@ +[Unit] +Description=NFS Mount Daemon +After=rpcbind.service nfs-server.service +Requires=rpcbind.service nfs-server.service + +[Service] +EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf +ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service new file mode 100644 index 000000000..147d7a7b5 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service @@ -0,0 +1,18 @@ +[Unit] +Description=NFS Server +Requires=rpcbind.service nfs-mountd.service +After=rpcbind.service + +[Service] +Type=oneshot +EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf +ExecStartPre=@SBINDIR@/exportfs -r +ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT +ExecStop=@SBINDIR@/rpc.nfsd 0 +ExecStopPost=@SBINDIR@/exportfs -f +ExecReload=@SBINDIR@/exportfs -r +StandardError=syslog +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service new file mode 100644 index 000000000..746dacf05 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service @@ -0,0 +1,12 @@ +[Unit] +Description=NFS file locking service +After=rpcbind.service +Requires=rpcbind.service +Before=remote-fs-pre.target + +[Service] +EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf +ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch new file mode 100644 index 000000000..d8f818167 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch @@ -0,0 +1,36 @@ +Fixes errors like +sm-notify[1070]: DNS resolution of a.b.c.d..com failed; retrying later +This error will occur anytime sm-notify is run before the network if fully up, +which is happening more and more with parallel startup systems. +The res_init() call is simple, safe, quick, and a patch to use it should be +able to go upstream. Presumably the whole reason sm-notify tries several +times is to wait for possible changes to the network configuration, but without +calling res_init() it will never be aware of those changes + +Backported drom Fedora + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> + + +diff -up nfs-utils-1.2.3/utils/statd/sm-notify.c.orig nfs-utils-1.2.3/utils/statd/sm-notify.c +--- nfs-utils-1.2.3/utils/statd/sm-notify.c.orig 2010-09-28 08:24:16.000000000 -0400 ++++ nfs-utils-1.2.3/utils/statd/sm-notify.c 2010-10-15 16:44:43.487119601 -0400 +@@ -28,6 +28,9 @@ + #include <netdb.h> + #include <errno.h> + #include <grp.h> ++#include <netinet/in.h> ++#include <arpa/nameser.h> ++#include <resolv.h> + + #include "sockaddr.h" + #include "xlog.h" +@@ -84,6 +87,7 @@ smn_lookup(const char *name) + }; + int error; + ++ res_init(); + error = getaddrinfo(name, NULL, &hint, &ai); + if (error != 0) { + xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error)); diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch new file mode 100644 index 000000000..993f1e5ea --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch @@ -0,0 +1,42 @@ +nfs-utils: Do not pass CFLAGS to gcc while building + +Do not pass CFLAGS/LDFLAGS to gcc while building, The needed flags has +been passed by xxx_CFLAGS=$(CFLAGS_FOR_BUILD). + +Upstream-Status: Pending + +Signed-off-by: Chong Lu <Chong.Lu@windriver.com> +--- + tools/locktest/Makefile.am | 2 ++ + tools/rpcgen/Makefile.am | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am +index 3156815..1729fd1 100644 +--- a/tools/locktest/Makefile.am ++++ b/tools/locktest/Makefile.am +@@ -1,6 +1,8 @@ + ## Process this file with automake to produce Makefile.in + + CC=$(CC_FOR_BUILD) ++CFLAGS= ++LDFLAGS= + LIBTOOL = @LIBTOOL@ --tag=CC + + noinst_PROGRAMS = testlk +diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am +index 8a9ec89..8bacdaa 100644 +--- a/tools/rpcgen/Makefile.am ++++ b/tools/rpcgen/Makefile.am +@@ -1,6 +1,8 @@ + ## Process this file with automake to produce Makefile.in + + CC=$(CC_FOR_BUILD) ++CFLAGS= ++LDFLAGS= + LIBTOOL = @LIBTOOL@ --tag=CC + + noinst_PROGRAMS = rpcgen +-- +1.7.9.5 + diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf new file mode 100644 index 000000000..a1007a7fb --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf @@ -0,0 +1,35 @@ +# Parameters to be passed to nfs-utils (clients & server) service files. +# + +# Options to pass to rpc.nfsd. +NFSD_OPTS="" + +# Number of servers to start up; the default is 8 servers. +NFSD_COUNT="" + +# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd". +PROCNFSD_MOUNTPOINT="" + +# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid". +PROCNFSD_MOUNTOPTS="" + +# Options for rpc.mountd. +# If you have a port-based firewall, you might want to set up +# a fixed port here using the --port option. +MOUNTD_OPTS="" + +# Parameters to be passed to nfs-common (nfs clients & server) init script. +# + +# If you do not set values for the NEED_ options, they will be attempted +# autodetected; this should be sufficient for most people. Valid alternatives +# for the NEED_ options are "yes" and "no". + +# Do you want to start the statd daemon? It is not needed for NFSv4. +NEED_STATD="" + +# Options to pass to rpc.statd. +# N.B. statd normally runs on both client and server, and run-time +# options should be specified accordingly. +# STATD_OPTS="-p 32765 -o 32766" +STATD_OPTS="" diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon new file mode 100644 index 000000000..992267d5a --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon @@ -0,0 +1,63 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: nfs-common +# Required-Start: $portmap hwclock +# Required-Stop: $portmap hwclock +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: NFS support for both client and server +# Description: NFS is a popular protocol for file sharing across +# TCP/IP networks. This service provides various +# support functions for NFS mounts. +### END INIT INFO +# +# Startup script for nfs-utils +# +# +# Location of executables: + +# Source function library. +. /etc/init.d/functions + +test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd +test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid +# +# The default state directory is /var/lib/nfs +test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs +# +#---------------------------------------------------------------------- +# Startup and shutdown functions. +# Actual startup/shutdown is at the end of this file. + +start_statd(){ + echo -n "starting statd: " + start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID" + echo done +} +stop_statd(){ + echo -n 'stopping statd: ' + start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID" + echo done +} +#---------------------------------------------------------------------- +# +# supported options: +# start +# stop +# restart: stops and starts mountd +#FIXME: need to create the /var/lib/nfs/... directories +case "$1" in + start) + start_statd;; + stop) + stop_statd;; + status) + status $NFS_STATD + exit $?;; + restart) + $0 stop + $0 start;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 1;; +esac diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver new file mode 100644 index 000000000..7ed93a59d --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver @@ -0,0 +1,130 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: nfs-kernel-server +# Required-Start: $remote_fs nfs-common $portmap hwclock +# Required-Stop: $remote_fs nfs-common $portmap hwclock +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Kernel NFS server support +# Description: NFS is a popular protocol for file sharing across +# TCP/IP networks. This service provides NFS server +# functionality, which is configured via the +# /etc/exports file. +### END INIT INFO +# +# Startup script for nfs-utils +# +# Source function library. +. /etc/init.d/functions +# +# The environment variable NFS_SERVERS may be set in /etc/default/nfsd +# Other control variables may be overridden here too +test -r /etc/default/nfsd && . /etc/default/nfsd +# +# Location of executables: +test -x "$NFS_MOUNTD" || NFS_MOUNTD=/usr/sbin/rpc.mountd +test -x "$NFS_NFSD" || NFS_NFSD=/usr/sbin/rpc.nfsd +# +# The user mode program must also exist (it just starts the kernel +# threads using the kernel module code). +test -x "$NFS_MOUNTD" || exit 0 +test -x "$NFS_NFSD" || exit 0 +# +# Default is 8 threads, value is settable between 1 and the truely +# ridiculous 99 +test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -lt 100 || NFS_SERVERS=8 +# +#---------------------------------------------------------------------- +# Startup and shutdown functions. +# Actual startup/shutdown is at the end of this file. +#mountd +start_mountd(){ + echo -n 'starting mountd: ' + start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@" + echo done +} +stop_mountd(){ + echo -n 'stopping mountd: ' + start-stop-daemon --stop --quiet --exec "$NFS_MOUNTD" + echo done +} +# +#nfsd +start_nfsd(){ + modprobe -q nfsd + grep -q nfsd /proc/filesystems || { + echo NFS daemon support not enabled in kernel + exit 1 + } + grep -q nfsd /proc/mounts || mount -t nfsd nfsd /proc/fs/nfsd + grep -q nfsd /proc/mounts || { + echo nfsd filesystem could not be mounted at /proc/fs/nfsd + exit 1 + } + + echo -n "starting $1 nfsd kernel threads: " + start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" + echo done +} +delay_nfsd(){ + for delay in 0 1 2 3 4 5 6 7 8 9 + do + if pidof nfsd >/dev/null + then + echo -n . + sleep 1 + else + return 0 + fi + done + return 1 +} +stop_nfsd(){ + # WARNING: this kills any process with the executable + # name 'nfsd'. + echo -n 'stopping nfsd: ' + start-stop-daemon --stop --quiet --signal 1 --name nfsd + if delay_nfsd || { + echo failed + echo ' using signal 9: ' + start-stop-daemon --stop --quiet --signal 9 --name nfsd + delay_nfsd + } + then + echo done + else + echo failed + fi +} + +#---------------------------------------------------------------------- +# +# supported options: +# start +# stop +# reload: reloads the exports file +# restart: stops and starts mountd +#FIXME: need to create the /var/lib/nfs/... directories +case "$1" in + start) + exportfs -r + start_nfsd "$NFS_SERVERS" + start_mountd + test -r /etc/exports && exportfs -a;; + stop) exportfs -ua + stop_mountd + stop_nfsd;; + status) + status /usr/sbin/rpc.mountd + RETVAL=$? + status nfsd + rval=$? + [ $RETVAL -eq 0 ] && exit $rval + exit $RETVAL;; + reload) test -r /etc/exports && exportfs -r;; + restart) + $0 stop + $0 start;; + *) echo "Usage: $0 {start|stop|status|reload|restart}" + exit 1;; +esac diff --git a/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/proc-fs-nfsd.mount b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/proc-fs-nfsd.mount new file mode 100644 index 000000000..630801b37 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-connectivity/nfs-utils/nfs-utils/proc-fs-nfsd.mount @@ -0,0 +1,8 @@ +[Unit] +Description=NFSD configuration filesystem +After=systemd-modules-load.service + +[Mount] +What=nfsd +Where=/proc/fs/nfsd +Type=nfsd |