summaryrefslogtreecommitdiff
path: root/usr/src/cmd/iscsid/iscsi-initiator
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/iscsid/iscsi-initiator')
-rw-r--r--usr/src/cmd/iscsid/iscsi-initiator20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr/src/cmd/iscsid/iscsi-initiator b/usr/src/cmd/iscsid/iscsi-initiator
index 48b97f0f35..39d983ffff 100644
--- a/usr/src/cmd/iscsid/iscsi-initiator
+++ b/usr/src/cmd/iscsid/iscsi-initiator
@@ -22,6 +22,7 @@
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2020 Joyent, Inc.
#
#
@@ -170,6 +171,25 @@ mount_iscsi() {
}
umount_iscsi () {
+ # In case any non-system zpools reside on iscsi drives, export
+ # all of them now so that the system won't hang later in the shutdown
+ # sequence when those zpools need to be unmounted.
+ SYS_POOL=`svcprop -p config/zpool svc:/system/smartdc/init:default \
+ 2>/dev/null`
+ SYS_POOL=${SYS_POOL:-zones}
+
+ zpools=$(zpool list -Ho name)
+ for pool in $zpools; do
+ if [ "$pool" == $SYS_POOL ]; then
+ continue
+ fi
+ zpool export $pool
+ got=$?
+ if [ $got -ne 0 ]; then
+ echo "Exporting zpool $pool failed ($got)"
+ fi
+ done
+
#
# Generate iscsi mountp list from /etc/vfstab
exec < /etc/vfstab