Print this page
    
re #12264 cr3916 Need to apply patch ncp3-gate/patches/fs-local-zfs-boot-nexenta to 4.0
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/cmd/svc/milestone/fs-local
          +++ new/usr/src/cmd/svc/milestone/fs-local
   1    1  #!/sbin/sh
   2    2  #
   3    3  # CDDL HEADER START
   4    4  #
   5    5  # The contents of this file are subject to the terms of the
   6    6  # Common Development and Distribution License (the "License").
   7    7  # You may not use this file except in compliance with the License.
   8    8  #
   9    9  # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10   10  # or http://www.opensolaris.org/os/licensing.
  11   11  # See the License for the specific language governing permissions
  12   12  # and limitations under the License.
  13   13  #
  14   14  # When distributing Covered Code, include this CDDL HEADER in each
  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  # Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24  #
  25   25  
  26   26  . /lib/svc/share/smf_include.sh
  27   27  
  28   28  result=$SMF_EXIT_OK
  29   29  mntretry=0
  30   30  
  31   31  # Mount all local filesystems.
  32   32  
  33   33  cd /; /sbin/mountall -l >/var/run/fs-local 2>&1
  34   34  rc=$?
  35   35  if [ $rc -eq 111 ]; then
  36   36          #
  37   37          #  The only failures were lofs mounts, we can try again
  38   38          #  after zfs is mounted, there is a chance a lofs mount
  39   39          #  failed due to it depending on a zfs not yet mounted.
  40   40          #
  41   41          mntretry=1
  42   42  elif [ $rc -ne 0 ]; then
  43   43          cat /var/run/fs-local >/dev/msglog
  44   44          msg="WARNING: /sbin/mountall -l failed: exit status $rc"
  45   45          echo $msg
  46   46          echo "$SMF_FMRI:" $msg >/dev/msglog
  47   47          result=$SMF_EXIT_ERR_FATAL
  48   48  fi
  49   49  rm -f /var/run/fs-local
  50   50  
  51   51  #
  52   52  # If there are non-global UFS filesystems with quotas, check and enable them.
  53   53  #
  54   54  
  55   55  # vlist is the non-global filesystems in vfstab requesting quotas
  56   56  vlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" {
  57   57          if (match($7, "(^|,)(quota|rq)(,|$)") != 0 &&
  58   58              match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab`
  59   59  
  60   60  if [ -n "$vlist" ]; then
  61   61          # mlist is the filesystems in mnttab that are ufs, mounted rw,
  62   62          # and without quotas turned on
  63   63          mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" {
  64   64                  if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'`
  65   65  
  66   66          # qlist is the intersection of vlist and mlist
  67   67          qlist=`echo "$vlist\n-\n$mlist" | \
  68   68                  /usr/bin/nawk '{if ($1 == "-") { mlist = 1; }
  69   69                          else if (mlist == 0) { vlist[$1] = 1; }
  70   70                          else if (vlist[$1]) { print $1; } }'`
  71   71  
  72   72          #
  73   73          # Just check and enable the non-global UFS file systems with quotas
  74   74          # enabled. Note that "quotacheck -a" and "quotaon -a" will try
  75   75          # to process all UFS entries with quotas rather than excluding
  76   76          # the entries with the global option (the global entries are handled
  77   77          # later in another script if the cluster package is installed).
  78   78          #
  79   79          if [ -n "$qlist" ]; then
  80   80                  echo 'Checking UFS quotas: \c'
  81   81                  /usr/sbin/quotacheck -p $qlist
  82   82                  echo 'done.'
  83   83                  /usr/sbin/quotaon $qlist
  84   84          fi
  85   85  fi
  
    | 
      ↓ open down ↓ | 
    85 lines elided | 
    
      ↑ open up ↑ | 
  
  86   86  
  87   87  # Mount all ZFS filesystems.
  88   88  
  89   89  if [ -x /usr/sbin/zfs ]; then
  90   90          /usr/sbin/zfs mount -va >/dev/msglog 2>&1
  91   91          rc=$?
  92   92          if [ $rc -ne 0 ]; then
  93   93                  msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc"
  94   94                  echo $msg
  95   95                  echo "$SMF_FMRI:" $msg >/dev/msglog
  96      -                result=$SMF_EXIT_ERR_FATAL
       96 +                # we do not fail fs-local in nexenta due to simplified
       97 +                # rootfs architecture...
  97   98          fi
  98   99  fi
  99  100  
 100  101  if [ $result = $SMF_EXIT_OK -a $mntretry -eq 1 ]
 101  102  then
 102  103          cd /; /sbin/mountall -l >/dev/msglog
 103  104          rc=$?
 104  105          if [ $rc -ne 0 ]; then
 105  106                  msg="WARNING: /sbin/mountall -l failed: exit status $rc"
 106  107                  echo $msg
 107  108                  echo "$SMF_FMRI:" $msg >/dev/msglog
 108  109                  result=$SMF_EXIT_ERR_FATAL
 109  110          fi
 110  111  fi
 111  112  
 112  113  # Add swap filesystems
 113  114  /sbin/swapadd >/dev/null 2>&1
 114  115  
 115  116  exit $result
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX