]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
btrfs/081: wait for reader process to exit before cycle mounting
authorFilipe Manana <fdmanana@suse.com>
Fri, 28 Jun 2024 17:04:49 +0000 (18:04 +0100)
committerZorro Lang <zlang@kernel.org>
Fri, 12 Jul 2024 19:05:35 +0000 (03:05 +0800)
We send a kill signal to the reader process, check the md5sum of the
files and then cycle mount the scratch device. Most of the time the
reader process has already terminated before we attempt the cycle mount,
but sometimes it may still be alive in which case the cat command
executed by the reader process may fail because the scratch fs was
unmounted and the target file doesn't exist. This makes the cat command
print an error message and the test fail like this:

     Verifying file digests after cloning
     14968c092c68e32fa35e776392d14523  SCRATCH_MNT/foo
     14968c092c68e32fa35e776392d14523  SCRATCH_MNT/bar
    +cat: /opt/scratch/bar: No such file or directory
    +cat: /opt/scratch/bar: No such file or directory
    +cat: /opt/scratch/bar: No such file or directory
    +cat: /opt/scratch/bar: No such file or directory
    ...
    (Run diff -u /opt/xfstests/tests/btrfs/081.out

Fix this by making the test wait for the reader to terminate after
sending it the kill signal.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/081

index 300ace53d409225a7d9d0e414dd44a1c3937bc32..35db6dd7d4f09e7f17e9b6bbceeb5cc9dc18af7b 100755 (executable)
@@ -81,6 +81,7 @@ $CLONER_PROG -s 0 -d 0 -l $(($num_extents * $extent_size)) \
        $SCRATCH_MNT/foo $SCRATCH_MNT/bar
 
 kill $reader_pid > /dev/null 2>&1
+wait $reader_pid
 
 # Now both foo and bar should have exactly the same content.
 # This didn't use to be the case before the btrfs kernel fix mentioned