summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-06-02 10:25:35 -0700
committerBrian Behlendorf <[email protected]>2011-06-02 10:25:35 -0700
commit36391312afdfac5584ca40ef1af7721108ce4c20 (patch)
tree2a8f10d5ecb2a94da5c07c28fdbf4c38f8388a7d /scripts
parent2ea9dc40f88ed84bc3e8022b91dd33cbce94653f (diff)
Always unload zpios.ko on exit
We should always unload zpios.ko on exit. This ensures that subsequent calls to 'zfs.sh -u' from other utilities will be able to unload the module stack and properly cleanup. This is important for the the --cleanup option which can be passed to zconfig.sh and zfault.sh.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/zpios.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/zpios.sh b/scripts/zpios.sh
index e16a58a3b..a5599a6d8 100755
--- a/scripts/zpios.sh
+++ b/scripts/zpios.sh
@@ -42,6 +42,15 @@ OPTIONS:
EOF
}
+unload_die() {
+ unload_modules
+ while [ -c /dev/zpios ]; do
+ sleep 1
+ done
+
+ exit 1
+}
+
print_header() {
echo --------------------- ZPIOS RESULTS ----------------------------
echo -n "Date: "; date
@@ -242,7 +251,7 @@ fi
# Create the zpool configuration
${ZPOOL_CREATE_SH} ${VERBOSE_FLAG} ${FORCE_FLAG} \
-p ${ZPOOL_NAME} -c ${ZPOOL_CONFIG} \
- -l "${ZPOOL_OPTIONS}" -s "${ZFS_OPTIONS}" || exit 1
+ -l "${ZPOOL_OPTIONS}" -s "${ZFS_OPTIONS}" || unload_die
if [ ${PROFILE} ]; then
zpios_profile_start
@@ -261,7 +270,7 @@ fi
# Destroy the zpool configuration
${ZPOOL_CREATE_SH} ${VERBOSE_FLAG} ${FORCE_FLAG} \
- -p ${ZPOOL_NAME} -c ${ZPOOL_CONFIG} -d || exit 1
+ -p ${ZPOOL_NAME} -c ${ZPOOL_CONFIG} -d || unload_die
# Unload the test module stack and wait for device removal
unload_modules