summaryrefslogtreecommitdiff
path: root/usr/src/cmd/iscsid
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-01-21 08:16:37 -0700
committerGitHub <noreply@github.com>2020-01-21 08:16:37 -0700
commit472ac09f491ec5677bf42999b41c85106b229a36 (patch)
tree488fb9c82efbaa8ae5f9ec4028f033e10fd109e2 /usr/src/cmd/iscsid
parente1fef57229f9f30311ee0fc115aa73d868ce14e2 (diff)
downloadillumos-joyent-472ac09f491ec5677bf42999b41c85106b229a36.tar.gz
OS-8093 rebooting with a zpool over iscsi hangs machine indefinitely (#254)
Reviewed by: Kody Kantor <kody.kantor@joyent.com> Reviewed by: John Levon <john.levon@joyent.com> Approved by: Kody Kantor <kody.kantor@joyent.com>
Diffstat (limited to 'usr/src/cmd/iscsid')
-rw-r--r--usr/src/cmd/iscsid/iscsi-initiator20
-rw-r--r--usr/src/cmd/iscsid/iscsi-initiator.xml17
2 files changed, 36 insertions, 1 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
diff --git a/usr/src/cmd/iscsid/iscsi-initiator.xml b/usr/src/cmd/iscsid/iscsi-initiator.xml
index 42e0f21384..5f74945ac6 100644
--- a/usr/src/cmd/iscsid/iscsi-initiator.xml
+++ b/usr/src/cmd/iscsid/iscsi-initiator.xml
@@ -23,6 +23,7 @@
CDDL HEADER END
Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright 2020 Joyent, Inc.
Service manifests for the iSCSI Initiator
-->
@@ -98,6 +99,20 @@ potential to specialize all the properties/methods.
<service_fmri value='svc:/network/loopback' />
</dependency>
+ <!--
+ We declare a dependency on the optional iscsi-target svc so that it
+ will not shutdown before the initiator svc. In this way we can use
+ targets on the same machine and not see a failure or hang when we're
+ exporting any zpools that might be using local targets.
+ -->
+ <dependency
+ name='iscsi-target'
+ grouping='optional_all'
+ restart_on='error'
+ type='service'>
+ <service_fmri value='svc:/network/iscsi/target' />
+ </dependency>
+
<dependent
name='iscsi-initiator_multi-user'
grouping='optional_all'
@@ -136,7 +151,7 @@ potential to specialize all the properties/methods.
<method_credential
user='root'
group='root'
- privileges='basic,sys_devices,sys_mount'
+ privileges='basic,sys_config,sys_devices,sys_mount'
/>
</method_context>
</exec_method>