Print this page
8891 One unmountable dataset on rpool breaks a lot of things
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 #
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
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 +# Copyright 2017 RackTop Systems.
24 25 #
25 26
26 27 . /lib/svc/share/smf_include.sh
27 28
28 29 result=$SMF_EXIT_OK
29 30 mntretry=0
30 31
31 32 # Mount all local filesystems.
32 33
33 34 cd /; /sbin/mountall -l >/var/run/fs-local 2>&1
34 35 rc=$?
35 36 if [ $rc -eq 111 ]; then
36 37 #
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
37 38 # The only failures were lofs mounts, we can try again
38 39 # after zfs is mounted, there is a chance a lofs mount
39 40 # failed due to it depending on a zfs not yet mounted.
40 41 #
41 42 mntretry=1
42 43 elif [ $rc -ne 0 ]; then
43 44 cat /var/run/fs-local >/dev/msglog
44 45 msg="WARNING: /sbin/mountall -l failed: exit status $rc"
45 46 echo $msg
46 47 echo "$SMF_FMRI:" $msg >/dev/msglog
47 - result=$SMF_EXIT_ERR_FATAL
48 + result=$SMF_EXIT_MON_DEGRADE
48 49 fi
49 50 rm -f /var/run/fs-local
50 51
51 52 #
52 53 # If there are non-global UFS filesystems with quotas, check and enable them.
53 54 #
54 55
55 56 # vlist is the non-global filesystems in vfstab requesting quotas
56 57 vlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" {
57 58 if (match($7, "(^|,)(quota|rq)(,|$)") != 0 &&
58 59 match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab`
59 60
60 61 if [ -n "$vlist" ]; then
61 62 # mlist is the filesystems in mnttab that are ufs, mounted rw,
62 63 # and without quotas turned on
63 64 mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" {
64 65 if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'`
65 66
66 67 # qlist is the intersection of vlist and mlist
67 68 qlist=`echo "$vlist\n-\n$mlist" | \
68 69 /usr/bin/nawk '{if ($1 == "-") { mlist = 1; }
69 70 else if (mlist == 0) { vlist[$1] = 1; }
70 71 else if (vlist[$1]) { print $1; } }'`
71 72
72 73 #
73 74 # Just check and enable the non-global UFS file systems with quotas
74 75 # enabled. Note that "quotacheck -a" and "quotaon -a" will try
75 76 # to process all UFS entries with quotas rather than excluding
76 77 # the entries with the global option (the global entries are handled
77 78 # later in another script if the cluster package is installed).
78 79 #
79 80 if [ -n "$qlist" ]; then
80 81 echo 'Checking UFS quotas: \c'
81 82 /usr/sbin/quotacheck -p $qlist
82 83 echo 'done.'
83 84 /usr/sbin/quotaon $qlist
84 85 fi
85 86 fi
↓ open down ↓ |
28 lines elided |
↑ open up ↑ |
86 87
87 88 # Mount all ZFS filesystems.
88 89
89 90 if [ -x /usr/sbin/zfs ]; then
90 91 /usr/sbin/zfs mount -va >/dev/msglog 2>&1
91 92 rc=$?
92 93 if [ $rc -ne 0 ]; then
93 94 msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc"
94 95 echo $msg
95 96 echo "$SMF_FMRI:" $msg >/dev/msglog
96 - result=$SMF_EXIT_ERR_FATAL
97 + result=$SMF_EXIT_MON_DEGRADE
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 - result=$SMF_EXIT_ERR_FATAL
109 + result=$SMF_EXIT_MON_DEGRADE
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