LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: fstests@vger.kernel.org
Cc: hare@suse.de, dgilbert@interlog.com, jeyu@kernel.org,
	lucas.demarchi@intel.com, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH v2 1/3] fstests: use udevadm settle after pvremove
Date: Wed, 11 Aug 2021 08:45:10 -0700	[thread overview]
Message-ID: <20210811154512.1813622-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20210811154512.1813622-1-mcgrof@kernel.org>

As with creation, we also need to use udevadm settle
when removing a pv, otherwise we can trip on races with
module removals for the block devices in use.

This reduces the amount of time in which a block device
module refcnt for test modules such as scsi_debug spends
outside of 0.

Races with the refcnt being greater than 0 means module
removal can fail causing false positives. This helps
ensure that the pv is really long gone. These issues
are tracked for scsi_debug [0] and later found to be a
generic issue regardless of filesystem with pvremove [1].

Using udevadm settle *helps*, it does not address all
possible races with the refcnt as noted in the generic
bug entry [1].

[0] https://bugzilla.kernel.org/show_bug.cgi?id=212337
[1] https://bugzilla.kernel.org/show_bug.cgi?id=214015
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 tests/generic/081 | 5 ++++-
 tests/generic/108 | 1 +
 tests/generic/459 | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/generic/081 b/tests/generic/081
index f795b2c1..8e552074 100755
--- a/tests/generic/081
+++ b/tests/generic/081
@@ -12,6 +12,7 @@ _begin_fstest auto quick
 # Override the default cleanup function.
 _cleanup()
 {
+	local pv_ret
 	cd /
 	rm -f $tmp.*
 
@@ -34,7 +35,9 @@ _cleanup()
 		$UMOUNT_PROG $mnt >> $seqres.full 2>&1
 		$LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1
 		$LVM_PROG pvremove -f $SCRATCH_DEV >>$seqres.full 2>&1
-		test $? -eq 0 && break
+		pv_ret=$?
+		$UDEV_SETTLE_PROG
+		test $pv_ret -eq 0 && break
 		sleep 2
 	done
 }
diff --git a/tests/generic/108 b/tests/generic/108
index 7dd426c1..b7797e8f 100755
--- a/tests/generic/108
+++ b/tests/generic/108
@@ -21,6 +21,7 @@ _cleanup()
 	$UMOUNT_PROG $SCRATCH_MNT >>$seqres.full 2>&1
 	$LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1
 	$LVM_PROG pvremove -f $SCRATCH_DEV $SCSI_DEBUG_DEV >>$seqres.full 2>&1
+	$UDEV_SETTLE_PROG
 	_put_scsi_debug_dev
 	rm -f $tmp.*
 }
diff --git a/tests/generic/459 b/tests/generic/459
index e5e5e9ab..5b44e245 100755
--- a/tests/generic/459
+++ b/tests/generic/459
@@ -29,6 +29,7 @@ _cleanup()
 	$UMOUNT_PROG $SCRATCH_MNT >>$seqres.full 2>&1
 	$LVM_PROG vgremove -ff $vgname >>$seqres.full 2>&1
 	$LVM_PROG pvremove -ff $SCRATCH_DEV >>$seqres.full 2>&1
+	$UDEV_SETTLE_PROG
 }
 
 # Import common functions.
-- 
2.30.2


  reply	other threads:[~2021-08-11 15:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 15:45 [PATCH v2 0/3] fstests: add patient module remover Luis Chamberlain
2021-08-11 15:45 ` Luis Chamberlain [this message]
2021-08-15 12:36   ` [PATCH v2 1/3] fstests: use udevadm settle after pvremove Eryu Guan
2021-08-11 15:45 ` [PATCH v2 2/3] common/module: add patient module rmmod support Luis Chamberlain
2021-08-15 12:29   ` Eryu Guan
2021-08-18 14:02     ` Luis Chamberlain
2021-08-19  2:26       ` Eryu Guan
2021-08-19 23:58         ` Luis Chamberlain
2021-08-11 15:45 ` [PATCH v2 3/3] common/scsi_debug: use the patient module remover Luis Chamberlain
2021-08-15 12:35   ` Eryu Guan
2021-08-20  0:33     ` Luis Chamberlain

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=20210811154512.1813622-2-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=dgilbert@interlog.com \
    --cc=fstests@vger.kernel.org \
    --cc=hare@suse.de \
    --cc=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --subject='Re: [PATCH v2 1/3] fstests: use udevadm settle after pvremove' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).