diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2017-11-15 16:47:59 -0700 |
---|---|---|
committer | Eryu Guan <eguan@redhat.com> | 2017-11-16 17:04:03 +0800 |
commit | 53803e93a00cc29bcd1b1e9bef9e7c0d651023a7 (patch) | |
tree | 577fa1cdf546f32d7a61df67026f0381f719398d | |
parent | 6ee333cec470933d3b284cc8776d1a0d802b24e9 (diff) | |
download | xfstests-53803e93a00cc29bcd1b1e9bef9e7c0d651023a7.tar.gz |
btrfs/143: make test case more reliable
This changes to use '_scratch_cycle_mount' to drop all caches btrfs
could have in order to avoid an issue that drop_caches somehow
doesn't work on Nikolay's box.
Also use bash -c to run 'read' only when %pid is odd so that we can
read the faulty disk.
Reported-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Tested-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
-rwxr-xr-x | tests/btrfs/143 | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/btrfs/143 b/tests/btrfs/143 index da7bfd8c45..3875b6c43b 100755 --- a/tests/btrfs/143 +++ b/tests/btrfs/143 @@ -127,16 +127,16 @@ 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 -while true; do - # start_fail only fails the following buffered read so the repair is - # supposed to work. - echo 3 > /proc/sys/vm/drop_caches - start_fail - $XFS_IO_PROG -c "pread 0 4K" "$SCRATCH_MNT/foobar" > /dev/null & - pid=$! - wait - stop_fail - [ $((pid % 2)) == 1 ] && break +while [[ -z ${result} ]]; do + # invalidate the page cache. + _scratch_cycle_mount + + start_fail + result=$(bash -c " + if [[ \$((\$\$ % 2)) -eq 1 ]]; then + exec $XFS_IO_PROG -c \"pread 0 4K\" \"$SCRATCH_MNT/foobar\" + fi"); + stop_fail done _scratch_unmount |