08211a1
From 83a420674b7c1328ffb944678619595a431ffa48 Mon Sep 17 00:00:00 2001
08211a1
From: Dave Young <dyoung@redhat.com>
08211a1
Date: Wed, 11 Jul 2012 13:08:18 +0800
08211a1
Subject: [PATCH] nfs: install modprobe config file
08211a1
08211a1
install nfs modprobe config file
08211a1
08211a1
For nfs4, in case nfs.ko is not loaded mount.nfs4 will try to load
08211a1
nfs4.ko instead of nfs.ko. Fedora nfs-utils creates a lib/modprobe.d/nfs.conf
08211a1
in which there's below alias:
08211a1
alias nfs4 nfs
08211a1
08211a1
Dracut also need this file to auto load nfs kernel module.
08211a1
08211a1
Tested booting to a fedora 17 nfsroot share.
08211a1
08211a1
Signed-off-by: Dave Young <dyoung@redhat.com>
08211a1
---
08211a1
 modules.d/95nfs/module-setup.sh  |    6 ++++++
08211a1
 modules.d/95nfs/parse-nfsroot.sh |    7 -------
08211a1
 2 files changed, 6 insertions(+), 7 deletions(-)
08211a1
08211a1
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
08211a1
index b170de5..0c07725 100755
08211a1
--- a/modules.d/95nfs/module-setup.sh
08211a1
+++ b/modules.d/95nfs/module-setup.sh
08211a1
@@ -35,6 +35,12 @@ install() {
08211a1
         mount.nfs4 umount rpc.idmapd sed /etc/netconfig
08211a1
     dracut_install /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
08211a1
 
08211a1
+    if [ -f /lib/modprobe.d/nfs.conf ]; then
08211a1
+        dracut_install /lib/modprobe.d/nfs.conf
08211a1
+    else
08211a1
+        echo "alias nfs4 nfs" > $initdir/etc/modprobe.d/nfs.conf
08211a1
+    fi
08211a1
+
08211a1
     inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'
08211a1
 
08211a1
     _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
08211a1
diff --git a/modules.d/95nfs/parse-nfsroot.sh b/modules.d/95nfs/parse-nfsroot.sh
08211a1
index 4e69edc..769d233 100755
08211a1
--- a/modules.d/95nfs/parse-nfsroot.sh
08211a1
+++ b/modules.d/95nfs/parse-nfsroot.sh
08211a1
@@ -88,13 +88,6 @@ nfsroot_to_var $netroot
08211a1
 # Set fstype, might help somewhere
08211a1
 fstype=${nfs#/dev/}
08211a1
 
08211a1
-# NFS actually supported? Some more uglyness here: nfs3 or nfs4 might not
08211a1
-# be in the module...
08211a1
-if ! incol2 /proc/filesystems $fstype ; then
08211a1
-    modprobe nfs
08211a1
-    incol2 /proc/filesystems $fstype || die "nfsroot type $fstype requested but kernel/initrd does not support nfs"
08211a1
-fi
08211a1
-
08211a1
 # Rewrite root so we don't have to parse this uglyness later on again
08211a1
 netroot="$fstype:$server:$path:$options"
08211a1