]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: stat the dev we're removing to make sure its' really gone
authorJosef Bacik <jbacik@fusionio.com>
Mon, 21 Oct 2013 16:13:53 +0000 (16:13 +0000)
committerRich Johnston <rjohnston@sgi.com>
Tue, 22 Oct 2013 21:25:36 +0000 (16:25 -0500)
I've been periodically failing btrfs/003 because my box sometimes takes a little
longer to unregister the device when we remove it and so the output from btrfs
dev show doesn't match what we are wanting since it still sees the device.  To
fix this just stat and sleep if we still see the device node and only continue
once udev or whatever actually removes the device node so that we don't get
random failures.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
common/rc
tests/btrfs/003

index b2539487ffc7f2cf1a6f7a50b2d514f27e91f3fb..b5eb58264441bda6bcbaf57c08ec2d5895b9870a 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2093,7 +2093,16 @@ _require_freeze()
 # ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev
 _devmgt_remove()
 {
-       echo 1 > /sys/class/scsi_device/${1}/device/delete || _fail "Remove disk failed"
+       local lun=$1
+       local disk=$2
+
+       echo 1 > /sys/class/scsi_device/${lun}/device/delete || _fail "Remove disk failed"
+
+       stat $disk > /dev/null 2>&1
+       while [ $? -eq 0 ]; do
+               sleep 1
+               stat $disk > /dev/null 2>&1
+       done
 }
 
 # arg 1 is dev to add and is output of the below eg.
index 97938d27a2eaea53f28293c2f0d23e4bded4dc88..9105d064ab7eaebc1c12621f01a7911dc9eeebe1 100755 (executable)
@@ -145,7 +145,7 @@ _test_replace()
        DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d "/" -f 3 | rev`
 
        #fail disk
-       _devmgt_remove ${DEVHTL}
+       _devmgt_remove ${DEVHTL} $ds
        dev_removed=1
 
        $BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep "Some devices missing" >> $seqres.full || _fail \