Print this page
NEX-15279 support NFS server in zone
NEX-15520 online NFS shares cause zoneadm halt to hang in nfs_export_zone_fini
Portions contributed by: Dan Kruchinin dan.kruchinin@nexenta.com
Portions contributed by: Stepan Zastupov stepan.zastupov@gmail.com
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-1704 Clustered NFSv4 could cause I/O errors on clients after failover
Reviewed by:  Evan Layton <evan.layton@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-4122 All kernel messages seem to come from 'genunix' instead of individual modules after illumos #5272
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
NEX-4036 Unable to enable the nfs/server service when nothing is shared
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>

@@ -20,12 +20,12 @@
 # CDDL HEADER END
 #
 
 #
 # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
 # Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
+# Copyright 2018 Nexenta Systems, Inc.
 #
 
 # Start/stop processes required for server NFS
 
 . /lib/svc/share/smf_include.sh

@@ -64,18 +64,10 @@
         svcadm restart $IPF_FMRI
 }
 
 case "$1" in
 'start')
-        # The NFS server is not supported in a local zone
-        if smf_is_nonglobalzone; then
-                /usr/sbin/svcadm disable -t svc:/network/nfs/server
-                echo "The NFS server is not supported in a local zone"
-                sleep 5 &
-                exit $SMF_EXIT_OK
-        fi
-
         # Share all file systems enabled for sharing. sharemgr understands
         # regular shares and ZFS shares and will handle both. Technically,
         # the shares would have been started long before getting here since
         # nfsd has a dependency on them.
 

@@ -91,11 +83,33 @@
                 echo "$0: mountd failed with $rc"
                 sleep 5 &
                 exit $SMF_EXIT_ERR_FATAL
         fi
 
-        /usr/lib/nfs/nfsd
+        NFS_OPTS=
+        if [ -f /opt/HAC/bin/rsf.sh ]; then
+                . /opt/HAC/bin/rsf.sh
+
+                if [ -f "$PRODUCT_CONFIG" ]; then
+                        RSF_MNTS=$(/usr/bin/grep MOUNT_POINT "$PRODUCT_CONFIG" |\
+                            /usr/bin/sed -e 's/^.*MOUNT_POINT.*\"\(.*\)\"$/\1/')
+
+                        for RSF_MNT in $RSF_MNTS; do
+                                MATCH=$(/usr/bin/cat /etc/mnttab |\
+                                    /usr/bin/awk '{print $2}' |\
+                                    /usr/bin/egrep "^$RSF_MNT\$")
+
+                                if [ -n "$MATCH" ]; then
+                                        /usr/bin/mkdir -p "$RSF_MNT/.nfs"
+                                        /usr/bin/chown daemon:daemon "$RSF_MNT/.nfs"
+                                        NFS_OPTS="$NFS_OPTS -s $RSF_MNT/.nfs"
+                                fi
+                        done
+                fi
+        fi
+
+        /usr/lib/nfs/nfsd $NFS_OPTS
         rc=$?
         if [ $rc != 0 ]; then
                 /usr/sbin/svcadm mark -t maintenance svc:/network/nfs/server
                 echo "$0: nfsd failed with $rc"
                 sleep 5 &