fstest: btrfs/142 fix match the device and stripe id
diff mbox series

Message ID 1576047204-30621-1-git-send-email-anand.jain@oracle.com
State New
Headers show
Series
  • fstest: btrfs/142 fix match the device and stripe id
Related show

Commit Message

Anand Jain Dec. 11, 2019, 6:53 a.m. UTC
We re-aliened the device allocation order to the device id oder, if the
available space on the device is all same. So for this reason the test
cases which is hard coded with the device and the stripe id fails. Fix
it with the new expected device and stripe id.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tests/btrfs/142 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/tests/btrfs/142 b/tests/btrfs/142
index a23fe1bf4b75..95caddfd770a 100755
--- a/tests/btrfs/142
+++ b/tests/btrfs/142
@@ -89,12 +89,13 @@  $XFS_IO_PROG -f -d -c "pwrite -S 0xaa -b 128K 0 128K" "$SCRATCH_MNT/foobar" |\
 
 # step 2, corrupt the first 64k of one copy (on SCRATCH_DEV which is the first
 # one in $SCRATCH_DEV_POOL
-echo "step 2......corrupt file extent" >>$seqres.full
 
 ${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar >> $seqres.full
 logical_in_btrfs=`${FILEFRAG_PROG} -v $SCRATCH_MNT/foobar | _filter_filefrag | cut -d '#' -f 1`
 physical_on_scratch=`get_physical ${logical_in_btrfs}`
 
+echo "step 2......corrupt file extent on device $SCRATCH_DEV logic $logical_in_btrfs physical $physical_on_scratch" >>$seqres.full
+
 _scratch_unmount
 $XFS_IO_PROG -d -c "pwrite -S 0xbb -b 64K $physical_on_scratch 64K" $SCRATCH_DEV |\
 	_filter_xfs_io_offset
@@ -106,13 +107,13 @@  echo "step 3......repair the bad copy" >>$seqres.full
 
 # since raid1 consists of two copies, and the bad copy was put on stripe #1
 # while the good copy lies on stripe #0, the bad copy only gets access when the
-# reader's pid % 2 == 1 is true
+# reader's pid % 2 == 0 is true
 start_fail
 while [[ -z ${result} ]]; do
 	# enable task-filter only fails the following dio read so the repair is
 	# supposed to work.
 	result=$(bash -c "
-	if [[ \$((\$\$ % 2)) -eq 1 ]]; then
+	if [[ \$((\$\$ % 2)) -eq 0 ]]; then
 		echo 1 > /proc/\$\$/make-it-fail
 		exec $XFS_IO_PROG -d -c \"pread -b 128K 0 128K\" \"$SCRATCH_MNT/foobar\"
 	fi");