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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/nfs/svc/nfs-server
          +++ new/usr/src/cmd/fs.d/nfs/svc/nfs-server
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  25      -# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  26   25  # Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
       26 +# Copyright 2018 Nexenta Systems, Inc.
  27   27  #
  28   28  
  29   29  # Start/stop processes required for server NFS
  30   30  
  31   31  . /lib/svc/share/smf_include.sh
  32   32  . /lib/svc/share/ipf_include.sh
  33   33  zone=`smf_zonename`
  34   34  
  35   35  #
  36   36  # Handling a corner case here. If we were in offline state due to an
↓ open down ↓ 22 lines elided ↑ open up ↑
  59   59          #
  60   60          service_check_state $IPF_FMRI $SMF_ONLINE || return 0
  61   61          [ "`get_global_def_policy`" = "custom" ] && return 0
  62   62          [ "`get_policy $SMF_FMRI`" = "use_global" ] && return 0
  63   63  
  64   64          svcadm restart $IPF_FMRI
  65   65  }
  66   66  
  67   67  case "$1" in
  68   68  'start')
  69      -        # The NFS server is not supported in a local zone
  70      -        if smf_is_nonglobalzone; then
  71      -                /usr/sbin/svcadm disable -t svc:/network/nfs/server
  72      -                echo "The NFS server is not supported in a local zone"
  73      -                sleep 5 &
  74      -                exit $SMF_EXIT_OK
  75      -        fi
  76      -
  77   69          # Share all file systems enabled for sharing. sharemgr understands
  78   70          # regular shares and ZFS shares and will handle both. Technically,
  79   71          # the shares would have been started long before getting here since
  80   72          # nfsd has a dependency on them.
  81   73  
  82   74          # restart stopped shares from the repository
  83   75          /usr/sbin/sharemgr start -P nfs -a
  84   76  
  85   77          # Options for nfsd are now set in SMF
  86   78  
  87   79          /usr/lib/nfs/mountd
  88   80          rc=$?
  89   81          if [ $rc != 0 ]; then
  90   82                  /usr/sbin/svcadm mark -t maintenance svc:/network/nfs/server
  91   83                  echo "$0: mountd failed with $rc"
  92   84                  sleep 5 &
  93   85                  exit $SMF_EXIT_ERR_FATAL
  94   86          fi
  95   87  
  96      -        /usr/lib/nfs/nfsd
       88 +        NFS_OPTS=
       89 +        if [ -f /opt/HAC/bin/rsf.sh ]; then
       90 +                . /opt/HAC/bin/rsf.sh
       91 +
       92 +                if [ -f "$PRODUCT_CONFIG" ]; then
       93 +                        RSF_MNTS=$(/usr/bin/grep MOUNT_POINT "$PRODUCT_CONFIG" |\
       94 +                            /usr/bin/sed -e 's/^.*MOUNT_POINT.*\"\(.*\)\"$/\1/')
       95 +
       96 +                        for RSF_MNT in $RSF_MNTS; do
       97 +                                MATCH=$(/usr/bin/cat /etc/mnttab |\
       98 +                                    /usr/bin/awk '{print $2}' |\
       99 +                                    /usr/bin/egrep "^$RSF_MNT\$")
      100 +
      101 +                                if [ -n "$MATCH" ]; then
      102 +                                        /usr/bin/mkdir -p "$RSF_MNT/.nfs"
      103 +                                        /usr/bin/chown daemon:daemon "$RSF_MNT/.nfs"
      104 +                                        NFS_OPTS="$NFS_OPTS -s $RSF_MNT/.nfs"
      105 +                                fi
      106 +                        done
      107 +                fi
      108 +        fi
      109 +
      110 +        /usr/lib/nfs/nfsd $NFS_OPTS
  97  111          rc=$?
  98  112          if [ $rc != 0 ]; then
  99  113                  /usr/sbin/svcadm mark -t maintenance svc:/network/nfs/server
 100  114                  echo "$0: nfsd failed with $rc"
 101  115                  sleep 5 &
 102  116                  exit $SMF_EXIT_ERR_FATAL
 103  117          fi
 104  118  
 105  119          configure_ipfilter
 106  120          ;;
↓ open down ↓ 216 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX