From 84f737b448c4a8ba04e2af953e38006bde8b343b Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Thu, 15 Jul 2010 17:53:26 -0700 Subject: [PATCH] Only try to unload modules whose use count is 0 This avoids errors from zfs.sh -u when, for example, zlib_deflate is in use by btrfs. --- scripts/common.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/common.sh b/scripts/common.sh index 6f1f51d1c5..c1229b9864 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -168,8 +168,10 @@ unload_modules() { for MOD in ${MODULES_REVERSE[*]}; do local NAME=`basename ${MOD} .ko` + local USE_COUNT=`${LSMOD} | + egrep "^${NAME} "| ${AWK} '{print $3}'` - if ${LSMOD} | egrep -q "^${NAME}"; then + if [ "${USE_COUNT}" = 0 ] ; then if [ "${DUMP_LOG}" -a ${NAME} = "spl" ]; then spl_dump_log