bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] tests: avoid nasty FP-causing race condition


From: Jim Meyering
Subject: [PATCH 3/3] tests: avoid nasty FP-causing race condition
Date: Wed, 18 May 2011 16:57:19 +0200

From: Jim Meyering <address@hidden>

* tests/t9040-many-partitions.sh: Remove all partitions before
exiting -- otherwise, the rmmod-prompted removal of those many
partitions would continue long after rmmod completion and the
release of the scsi_debug lock, and thus partition-device removals
provoked by this test would cause failure in the subsequent test,
e.g., when the devices for partitions 14,15,16 have just been
successfully created (verified that they exist), yet the next
step -- to create a file system on one of them -- fails or is
erroneously skipped because the device has been removed asynchronously.
---
 tests/t9040-many-partitions.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
index a768579..1282c1f 100644
--- a/tests/t9040-many-partitions.sh
+++ b/tests/t9040-many-partitions.sh
@@ -68,4 +68,16 @@ $AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 
< d;"\
 parted -m -s $scsi_dev u s p > out || fail=1
 compare out exp || fail=1

+# We must remove these partitions before terminating.
+# Otherwise, even though cleanup-driven rmmod will eventually cause
+# them to be removed, they may continue to be removed long after
+# the rmmod cleanup lock has been released, and such removals
+# can (and regularly did) interfere with the following test.
+i=1
+while :; do
+    parted -s $scsi_dev rm $i || fail=1
+    test $i = $n_partitions && break
+    i=$((i+1))
+done
+
 Exit $fail
-- 
1.7.5.1.341.g177b8




reply via email to

[Prev in Thread] Current Thread [Next in Thread]