[nfs-utils] initscripts: just try to mount rpc_pipefs always

J. Bruce Fields bfields at fedoraproject.org
Mon Jul 4 13:33:09 UTC 2011


commit d37883f4821bff7bdf7f1bd42d8a16eda3884a2f
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Tue May 17 11:39:06 2011 -0400

    initscripts: just try to mount rpc_pipefs always
    
    Do not rely on modprobe.d hacks to mount the filesystem after loading the module.
    Mount the filesystem directly. The kernel will ask for the module if needed.
    
    This avoids race conditions between the initscripts running in parallel and it
    works with built-in sunrpc too.
    
    Later we can consider passing the responsibility to mount rpc_pipefs
    to a systemd {auto,}mount unit pair.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=702707
    
    Signed-off-by: J. Bruce Fields <bfields at redhat.com>

 rpcgssd.init    |   19 ++-----------------
 rpcidmapd.init  |   18 +-----------------
 rpcsvcgssd.init |   20 ++------------------
 3 files changed, 5 insertions(+), 52 deletions(-)
---
diff --git a/rpcgssd.init b/rpcgssd.init
index 29b4954..86e621b 100755
--- a/rpcgssd.init
+++ b/rpcgssd.init
@@ -58,23 +58,8 @@ case "$1" in
 	[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5"
 
 	# Make sure the rpc_pipefs filesystem is available
-	[ "${RPCMTAB}" != "noload" ] && {
-		RPCMTAB=`grep -v '^#' /proc/mounts | \
-			awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
-		[ -z "${RPCMTAB}" ] && {
-			[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
-				if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
-				 	/sbin/modprobe sunrpc
-				fi
-			}
-			RPCMTAB=`grep -v '^#' /proc/mounts | \
-				awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
-			[ -z "${RPCMTAB}" ] && { \
-				echo "Error: RPC MTAB does not exist."
-				exit 6
-			}
-		}
-	}
+	/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
+
 	[ "${SECURE_NFS_MODS}" != "noload" ] && {
 		[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
 			for i in ${SECURE_NFS_MODS}; do 
diff --git a/rpcidmapd.init b/rpcidmapd.init
index 0ce1507..513ffbb 100755
--- a/rpcidmapd.init
+++ b/rpcidmapd.init
@@ -57,23 +57,7 @@ case "$1" in
 	echo -n $"Starting RPC idmapd: "
 
 	# Make sure the rpc_pipefs filesystem is available
-	[ "${RPCMTAB}" != "noload" ] && {
-		RPCMTAB=`grep -v '^#' /proc/mounts | \
-			awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
-		[ -z "${RPCMTAB}" ] && {
-			[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
-				if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
-				 	/sbin/modprobe sunrpc
-				fi
-			}
-			RPCMTAB=`grep -v '^#' /proc/mounts | \
-				awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
-			[ -z "${RPCMTAB}" ] && { \
-				echo "Error: RPC MTAB does not exist."
-				exit 6
-			}
-		}
-	}
+	/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
 
 	# Start daemon.
 	daemon $prog ${RPCIDMAPDARGS}
diff --git a/rpcsvcgssd.init b/rpcsvcgssd.init
index 5f99b86..96d4c43 100755
--- a/rpcsvcgssd.init
+++ b/rpcsvcgssd.init
@@ -50,25 +50,9 @@ case "$1" in
 	# List of kernel modules to load
 	[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5"
 
-
 	# Make sure the rpc_pipefs filesystem is available
-	[ "${RPCMTAB}" != "noload" ] && {
-		RPCMTAB=`grep -v '^#' /proc/mounts | \
-			awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
-		[ -z "${RPCMTAB}" ] && {
-			[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
-				if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
-				 	/sbin/modprobe sunrpc
-				fi
-			}
-			RPCMTAB=`grep -v '^#' /proc/mounts | \
-				awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
-			[ -z "${RPCMTAB}" ] && { \
-				echo "Error: RPC MTAB does not exist."
-				exit 6
-			}
-		}
-	}
+	/bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1
+
 	[ "${SECURE_NFS_MODS}" != "noload" ] && {
 		[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
 		# Load rpcsec modules


More information about the scm-commits mailing list