* [PATCH] xfstests: test for scsi_debug before trying to rmmod it
@ 2012-03-08 23:51 Eric Sandeen
2012-03-09 0:05 ` [PATCH V2] xfstests: clean up scsi_debug module handling Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2012-03-08 23:51 UTC (permalink / raw)
To: xfs-oss; +Cc: Dave Chinner
_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"
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH V2] xfstests: clean up scsi_debug module handling
2012-03-08 23:51 [PATCH] xfstests: test for scsi_debug before trying to rmmod it Eric Sandeen
@ 2012-03-09 0:05 ` Eric Sandeen
2012-03-09 17:27 ` Ben Myers
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2012-03-09 0:05 UTC (permalink / raw)
To: xfs-oss; +Cc: Dave Chinner
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@redhat.com>
---
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"
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] xfstests: clean up scsi_debug module handling
2012-03-09 0:05 ` [PATCH V2] xfstests: clean up scsi_debug module handling Eric Sandeen
@ 2012-03-09 17:27 ` Ben Myers
0 siblings, 0 replies; 3+ messages in thread
From: Ben Myers @ 2012-03-09 17:27 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Dave Chinner, xfs-oss
Hey Eric,
On Thu, Mar 08, 2012 at 06:05:03PM -0600, Eric Sandeen wrote:
> 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@redhat.com>
This looks good to me.
Reviewed-by: Ben Myers <bpm@sgi.com>
> ---
>
> 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"
> }
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-09 17:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08 23:51 [PATCH] xfstests: test for scsi_debug before trying to rmmod it Eric Sandeen
2012-03-09 0:05 ` [PATCH V2] xfstests: clean up scsi_debug module handling Eric Sandeen
2012-03-09 17:27 ` Ben Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox