From 8c091798f26e7c1e6fd105e90065ebe12d97dfc2 Mon Sep 17 00:00:00 2001 From: Turbo Fredriksson Date: Tue, 24 Dec 2013 16:18:00 +0000 Subject: [PATCH] Add UNSHARING of filesystems and EXPORTING pools As a 'stop' action ensure the filesystem is unshared before it is unmounted, just in case. Additionally, export the pool so it may be cleanly imported by a different host. Signed-off-by: Turbo Fredriksson Signed-off-by: Brian Behlendorf Closes #2003 --- etc/init.d/zfs.lsb.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etc/init.d/zfs.lsb.in b/etc/init.d/zfs.lsb.in index e970e5717..f400fca32 100644 --- a/etc/init.d/zfs.lsb.in +++ b/etc/init.d/zfs.lsb.in @@ -106,10 +106,21 @@ stop() { [ ! -f "$LOCKFILE" ] && return 3 + log_begin_msg "Unsharing ZFS filesystems" + "$ZFS" unshare -a + log_end_msg $? + log_begin_msg "Unmounting ZFS filesystems" "$ZFS" umount -a log_end_msg $? + log_begin_msg "Exporting ZFS pools" + "$ZPOOL" list -H -o name | \ + while read pool; do + "$ZPOOL" export $pool + done + log_end_msg $? + rm -f "$LOCKFILE" }