[PATCH] xfstests: test for scsi_debug before trying to rmmod it

Eric Sandeen
2012-03-09T00:10:32Z

_cleanup does _put_scsi_debug_dev but there's a chance
the module has already been removed in the non-error
case.

If it's not loaded, don't try to rmmod it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/common.scsi_debug b/common.scsi_debug
index 9f9177c..08efa58 100644
--- a/common.scsi_debug
+++ b/common.scsi_debug
@@ -58,5 +58,6 @@ _get_scsi_debug_dev()
_put_scsi_debug_dev()
{
sleep 1
+ grep -q scsi_debug /proc/modules || return
rmmod scsi_debug || _fail "Could not remove scsi_debug module"
}