mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
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>
This commit is contained in:
+8
-8
@@ -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
|
||||
while [[ -z ${result} ]]; do
|
||||
# invalidate the page cache.
|
||||
_scratch_cycle_mount
|
||||
|
||||
start_fail
|
||||
$XFS_IO_PROG -c "pread 0 4K" "$SCRATCH_MNT/foobar" > /dev/null &
|
||||
pid=$!
|
||||
wait
|
||||
result=$(bash -c "
|
||||
if [[ \$((\$\$ % 2)) -eq 1 ]]; then
|
||||
exec $XFS_IO_PROG -c \"pread 0 4K\" \"$SCRATCH_MNT/foobar\"
|
||||
fi");
|
||||
stop_fail
|
||||
[ $((pid % 2)) == 1 ] && break
|
||||
done
|
||||
|
||||
_scratch_unmount
|
||||
|
||||
Reference in New Issue
Block a user