View | Details | Raw Unified | Return to bug 237517 | Differences between
and this patch

Collapse All | Expand All

(-)zfs (-1 / +49 lines)
Lines 16-21 Link Here
16
stop_cmd="zfs_stop"
16
stop_cmd="zfs_stop"
17
required_modules="zfs"
17
required_modules="zfs"
18
18
19
#
20
# Add the following lines to /etc/rc.conf to enable ZFS ordered mount:
21
# zfs_ordered_mount_enable (bool):                Mount ZFS in order (or NO).
22
# zfs_ordered_mount_zpoolname_egrep_filter (str): Optional egrep(1) pattern for filtering unwanted filesystems, one per zpool.
23
#                                                 Filesystems having canmount=off will be excluded automatically.
24
#
25
# Example:
26
# zfs_ordered_mount_enable="YES"
27
# zfs_ordered_mount_zroot_egrep_filter="zroot\$|zroot/ROOT|zroot/do-not-destroy"
28
# zfs_ordered_mount_zdata_egrep_filter="zdata\$|zdata/do-not-destroy"
29
#
30
31
zfs_ordered_mount_enable=${zfs_ordered_mount_enable:-"NO"}
32
19
zfs_start_jail()
33
zfs_start_jail()
20
{
34
{
21
	if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
35
	if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
Lines 25-35 Link Here
25
39
26
zfs_start_main()
40
zfs_start_main()
27
{
41
{
28
	zfs mount -va
42
	if checkyesno zfs_ordered_mount_enable; then
43
		local _zroot _zpool
44
45
		_zroot=`df -t zfs / | tail -1 | awk '{print $1}' | cut -d / -f 1`
46
47
		if [ -n "${_zroot}" ]; then
48
			zfs_mount_pool ${_zroot}
49
		fi
50
51
		for _zpool in `zpool list -Ho name`; do
52
			if [ "${_zpool}" != "${_zroot}" ]; then
53
				zfs_mount_pool ${_zpool}
54
			fi
55
		done
56
	else
57
		zfs mount -va
58
	fi
29
	zfs share -a
59
	zfs share -a
30
	if [ ! -r /etc/zfs/exports ]; then
60
	if [ ! -r /etc/zfs/exports ]; then
31
		touch /etc/zfs/exports
61
		touch /etc/zfs/exports
32
	fi
62
	fi
63
}
64
65
zfs_mount_pool()
66
{
67
	local _zpool _egrep_filter_name _egrep_filter _fs
68
	_zpool=${1}
69
70
	_egrep_filter_name=zfs_ordered_mount_${_zpool}_egrep_filter
71
	_egrep_filter=`eval echo \$\{${_egrep_filter_name}\}`
72
73
	if [ -n "${_egrep_filter}" ]; then
74
		# Need to separate our ^off from the user's specification.
75
		_egrep_filter="|${_egrep_filter}"
76
	fi
77
78
	for _fs in `zfs list -Hro canmount,name -t filesystem ${_zpool} | egrep -ve "^off${_egrep_filter}" | awk '{print $2}'`; do
79
		zfs mount -v ${_fs}
80
	done
33
}
81
}
34
82
35
zfs_start()
83
zfs_start()

Return to bug 237517