xfs
[Top] [All Lists]

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

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfstests: test for scsi_debug before trying to rmmod it
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Thu, 08 Mar 2012 17:51:55 -0600
Cc: Dave Chinner <dchinner@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
_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@xxxxxxxxxx>
---

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"
 }

<Prev in Thread] Current Thread [Next in Thread>