xfs
[Top] [All Lists]

[PATCH V2] xfstests: clean up scsi_debug module handling

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH V2] xfstests: clean up scsi_debug module handling
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Thu, 08 Mar 2012 18:05:03 -0600
Cc: Dave Chinner <dchinner@xxxxxxxxxx>
In-reply-to: <4F59461B.7040608@xxxxxxxxxx>
References: <4F59461B.7040608@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
2 little fixes to common scsi_debug handling.

* don't consider the scsi_debug module in use in
  _require, unless it can't be rmmod'd
* don't try to rmmod it in _put unless it is currently
  loaded

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

Argh.

diff --git a/common.scsi_debug b/common.scsi_debug
index 9f9177c..a085a67 100644
--- a/common.scsi_debug
+++ b/common.scsi_debug
@@ -26,7 +26,7 @@ _require_scsi_debug()
 {
        # make sure we have the module and it's not already used
        modinfo scsi_debug 2>&1 > /dev/null || _notrun "scsi_debug module not 
found"
-       lsmod | grep -wq scsi_debug && _notrun "scsi_debug module in use"
+       lsmod | grep -wq scsi_debug && (rmmod scsi_debug || _notrun "scsi_debug 
module in use")
        # make sure it has the features we need
        # logical/physical sectors plus unmap support all went in together
        modinfo scsi_debug | grep -wq sector_size || _notrun "scsi_debug too 
old"
@@ -58,5 +58,6 @@ _get_scsi_debug_dev()
 _put_scsi_debug_dev()
 {
        sleep 1
+       lsmod | grep -wq scsi_debug || return
        rmmod scsi_debug || _fail "Could not remove scsi_debug module"
 }

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