runqemu: Use the newer unfs3 for serving user space nfs
authorSaul Wold <sgw@linux.intel.com>
Thu, 23 Jan 2014 14:32:43 +0000 (08:32 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 28 Jan 2014 00:52:35 +0000 (00:52 +0000)
This new version correctly handles the 64bit ext3 / ext4 issues we
were seeing with the older unfs-server which did not handle 64bit file
systems correctly, producing the duplicate cookies.

[YOCTO #5639]

(From OE-Core rev: 2a59d55f712bbd79b1edf3ccb90ccabf609c9f0d)

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/runqemu-export-rootfs
scripts/runqemu-internal

index bbdaf5b..2d87996 100755 (executable)
@@ -88,8 +88,7 @@ MOUNT_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
 
 ## For debugging you would additionally add
 ## --debug all
-MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r -P $MOUNT_PORT"
-NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r"
+UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFS_NFSPROG -n $NFS_PORT -y $NFS_MOUNTPROG -m $MOUNT_PORT"
 
 # Setup the exports file
 if [ "$1" = "start" ]; then
@@ -115,53 +114,18 @@ case "$1" in
                exit 1
        fi
 
-       echo "Starting User Mode rpc.mountd"
-       echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS"
-       $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS
-       if [ ! $? = 0 ]; then
-               echo "====================="
-               echo "Error starting MOUNTD"
-               echo "====================="
-               if [ ! "x$RPCBIND_RUNNING" = "x" ] ; then
-                       echo "  If you see an error above that says:"
-                       echo "    RPC: Authentication error; why = Client credential too weak"
-                       echo "  You need to add the -i option when running rpcbind"
-                       echo "==============================================="
-                       echo "For recent Fedora/RedHat hosts:"
-                       echo "Add RPCBIND_ARGS=-i to /etc/sysconfig/rpcbind"
-                       echo "  or"
-                       echo "Add RPCBIND_OPTIONS=-i to /etc/sysconfig/rpcbind"
-                       echo "Then run as root: /etc/init.d/rpcbind restart"
-                       echo "==============================================="
-                       echo "For recent Debian/Ubuntu hosts:"
-                       echo "Add OPTIONS=\"-i -w\"  to /etc/default/rpcbind"
-                       echo "sudo service portmap restart"
-               fi
-
-               exit 1
-       fi
-
        echo "Starting User Mode nfsd"
-       echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS"
-       $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS
+       echo "  $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/unfsd $UNFSD_OPTS"
+       $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/unfsd $UNFSD_OPTS
        if [ ! $? = 0 ]; then
                echo "Error starting nfsd"
                exit 1
        fi
-       # Check to make sure everything started ok.
-       if [ ! -f $MOUNTPID ]; then
-               echo "rpc.mountd did not start correctly"
-               exit 1
-       fi
+        Check to make sure everything started ok.
        if [ ! -f $NFSPID ]; then
                echo "rpc.nfsd did not start correctly"
                exit 1
        fi
-       ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null
-       if [ ! $? = 0 ]; then
-               echo "rpc.mountd did not start correctly"
-               exit 1
-       fi
        ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
        if [ ! $? = 0 ]; then
                echo "rpc.nfsd did not start correctly"
@@ -169,16 +133,9 @@ case "$1" in
        fi
        echo " "
        echo "On your target please remember to add the following options for NFS"
-       echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp"
+       echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT"
        ;;
   stop)
-       if [ -f "$MOUNTPID" ]; then
-               echo "Stopping rpc.mountd"
-               kill `cat $MOUNTPID`
-               rm -f $MOUNTPID
-       else
-               echo "No PID file, not stopping rpc.mountd"
-       fi
        if [ -f "$NFSPID" ]; then
                echo "Stopping rpc.nfsd"
                kill `cat $NFSPID`
index 284b88c..cecb527 100755 (executable)
@@ -308,7 +308,7 @@ if [ "$FSTYPE" = "nfs" ]; then
     NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ]
     NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
     MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
-    UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,mountport=$MOUNTD_PORT"
+    UNFS_OPTS="nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT"
 
     PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo
     export PSEUDO_LOCALSTATEDIR