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.
This commit is contained in:
Ned Bass 2010-07-15 17:53:26 -07:00 committed by Brian Behlendorf
parent 548c9c6829
commit 84f737b448
1 changed files with 3 additions and 1 deletions

View File

@ -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