All of lore.kernel.org
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huawei.com>
To: guaneryu@gmail.com
Cc: houtao1@huawei.com, yangerkun@huawei.com, fstests@vger.kernel.org
Subject: [PATCH] common/scsi_debug: make sure scsi_debug been removed correctly
Date: Wed, 9 Jan 2019 13:48:45 +0800	[thread overview]
Message-ID: <20190109054845.93810-1-yangerkun@huawei.com> (raw)

Case generic/108 sometimes will fail while testing ext2, and the reson
is that rmmod scsi_debug in _put_scsi_debug_dev may randomly fail. Now
add the loop to do rmmod to make sure scsi_debug can be removed
correctly.

Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 common/scsi_debug | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/scsi_debug b/common/scsi_debug
index d9aa0bd..890ec68 100644
--- a/common/scsi_debug
+++ b/common/scsi_debug
@@ -45,11 +45,13 @@ _put_scsi_debug_dev()
 {
 	lsmod | grep -wq scsi_debug || return
 
-	n=2
+	n=15
 	# use redirection not -q option of modprobe here, because -q of old
 	# modprobe is only quiet when the module is not found, not when the
 	# module is in use.
-	while [ $n -ge 0 ] && ! modprobe -nr scsi_debug >/dev/null 2>&1; do
+	while [ $n -ge 0 ]; do
+		modprobe -r scsi_debug >/dev/null 2>&1
+		[ $? -eq 0 ] && return 0
 		sleep 1
 		n=$((n-1))
 	done
-- 
2.9.5

             reply	other threads:[~2019-01-09  5:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09  5:48 yangerkun [this message]
2019-01-09 21:02 ` [PATCH] common/scsi_debug: make sure scsi_debug been removed correctly Dave Chinner
2019-01-12  2:20   ` yangerkun
2019-01-13 15:21     ` Eryu Guan
2019-01-15  3:47     ` Dave Chinner
2019-01-15  5:31       ` yangerkun
2019-01-15  6:08         ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190109054845.93810-1-yangerkun@huawei.com \
    --to=yangerkun@huawei.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=houtao1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.