Message ID | 20220621173729.2135249-3-amir73il@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | aborted fstests may leave frozen fs behind | expand |
On Tue, Jun 21, 2022 at 08:37:28PM +0300, Amir Goldstein wrote: > Many of tests that freeze fs do not make sure that fs is unfrozen on > test termination. > > Some tests also need to kill and wait for writer processes after > unfreezing the fs. > > Signed-off-by: Amir Goldstein <amir73il@gmail.com> > --- The changes look good, and I didn't find regression issue from it for now. Please tell me your cencern if anyone has, or I'll merge it. Reviewed-by: Zorro Lang <zlang@redhat.com> > tests/generic/068 | 14 ++++++++++---- > tests/generic/085 | 3 +++ > tests/generic/280 | 13 ++++++++++++- > tests/generic/390 | 8 +++++++- > tests/generic/459 | 2 ++ > tests/generic/491 | 9 +++++++++ > tests/xfs/011 | 3 ++- > tests/xfs/119 | 9 +++++++++ > tests/xfs/297 | 11 +++++++++++ > tests/xfs/318 | 3 ++- > tests/xfs/325 | 3 ++- > tests/xfs/438 | 2 ++ > 12 files changed, 71 insertions(+), 9 deletions(-) > > diff --git a/tests/generic/068 b/tests/generic/068 > index 56262cd7..eeddf6d1 100755 > --- a/tests/generic/068 > +++ b/tests/generic/068 > @@ -17,9 +17,12 @@ ITERATIONS=10 > # Override the default cleanup function. > _cleanup() > { > - cd / > - > - trap 0 1 2 3 15 > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > + [ -n "$pid" ] && kill -9 $pid 2>/dev/null > + wait $pid > + cd / > + rm -f $tmp.* > } > > # Import common functions. > @@ -60,6 +63,7 @@ touch $tmp.running > rm -r $STRESS_DIR/* > rmdir $STRESS_DIR > } & > +pid=$! > > # start fstest -m loop in a background block; this gets us mmap coverage > { > @@ -75,6 +79,7 @@ touch $tmp.running > rm -rf $FSTEST_DIR/* > rmdir $FSTEST_DIR > } & > +pid="$pid $!" > > i=0 > let ITERATIONS=$ITERATIONS-1 > @@ -103,6 +108,7 @@ done > rm $tmp.running > > # wait for fsstresses to finish > -wait > +wait $pid > +unset pid > > exit 1 > diff --git a/tests/generic/085 b/tests/generic/085 > index 20cf875a..786d8e6f 100755 > --- a/tests/generic/085 > +++ b/tests/generic/085 > @@ -25,6 +25,8 @@ cleanup_dmdev() > { > # in case it's still suspended and/or mounted > $DMSETUP_PROG resume $lvdev >/dev/null 2>&1 > + [ -n "$pid" ] && kill -9 $pid 2>/dev/null > + wait $pid > $UMOUNT_PROG $lvdev >/dev/null 2>&1 > _dmsetup_remove $node > } > @@ -75,6 +77,7 @@ done & > pid="$pid $!" > > wait $pid > +unset pid > > status=0 > exit > diff --git a/tests/generic/280 b/tests/generic/280 > index 07144555..8e1ae4d2 100755 > --- a/tests/generic/280 > +++ b/tests/generic/280 > @@ -10,6 +10,17 @@ > . ./common/preamble > _begin_fstest auto quota freeze > > +# Override the default cleanup function. > +_cleanup() > +{ > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > + [ -n "$pid" ] && kill -9 $pid 2>/dev/null > + wait $pid > + cd / > + rm -f $tmp.* > +} > + > # Import common functions. > . ./common/filter > . ./common/quota > @@ -34,7 +45,7 @@ pid=$! > sleep 1 > xfs_freeze -u $SCRATCH_MNT > wait $pid > -_scratch_unmount > +unset pid > > # Failure comes in the form of a deadlock. > > diff --git a/tests/generic/390 b/tests/generic/390 > index 20c66e22..e8f6a5dc 100755 > --- a/tests/generic/390 > +++ b/tests/generic/390 > @@ -14,8 +14,12 @@ _begin_fstest auto freeze stress > _cleanup() > { > cd / > - # Make sure $SCRATCH_MNT is unfreezed > + # Kill freeze loops and make sure $SCRATCH_MNT is unfreezed > + [ -n "$freeze_pids" ] && kill -9 $freeze_pids 2>/dev/null > + wait $freeze_pids > xfs_freeze -u $SCRATCH_MNT 2>/dev/null > + [ -n "$fsstress_pid" ] && kill -9 $fsstress_pid 2>/dev/null > + wait $fsstress_pid > rm -f $tmp.* > } > > @@ -62,7 +66,9 @@ done > > wait $fsstress_pid > result=$? > +unset fsstress_pid > wait $freeze_pids > +unset freeze_pids > > # Exit with fsstress return value > status=$result > diff --git a/tests/generic/459 b/tests/generic/459 > index 57d58e55..7be39089 100755 > --- a/tests/generic/459 > +++ b/tests/generic/459 > @@ -24,6 +24,8 @@ _begin_fstest auto freeze thin > # Override the default cleanup function. > _cleanup() > { > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > cd / > rm -f $tmp.* > $UMOUNT_PROG $SCRATCH_MNT >>$seqres.full 2>&1 > diff --git a/tests/generic/491 b/tests/generic/491 > index e6e57dcd..797b08d5 100755 > --- a/tests/generic/491 > +++ b/tests/generic/491 > @@ -12,6 +12,15 @@ > . ./common/preamble > _begin_fstest auto quick freeze mount > > +# Override the default cleanup function. > +_cleanup() > +{ > + cd / > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > + rm -f $tmp.* > +} > + > # Import common functions. > . ./common/filter > > diff --git a/tests/xfs/011 b/tests/xfs/011 > index d6e9099e..ed44d074 100755 > --- a/tests/xfs/011 > +++ b/tests/xfs/011 > @@ -16,10 +16,11 @@ _begin_fstest auto freeze log metadata quick > # Override the default cleanup function. > _cleanup() > { > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > $KILLALL_PROG -9 fsstress 2>/dev/null > wait > cd / > - _scratch_unmount 2>/dev/null > rm -f $tmp.* > } > > diff --git a/tests/xfs/119 b/tests/xfs/119 > index b6f96601..5ffbce25 100755 > --- a/tests/xfs/119 > +++ b/tests/xfs/119 > @@ -11,6 +11,15 @@ > . ./common/preamble > _begin_fstest log v2log auto freeze > > +# Override the default cleanup function. > +_cleanup() > +{ > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > + cd / > + rm -f $tmp.* > +} > + > # Import common functions. > . ./common/filter > > diff --git a/tests/xfs/297 b/tests/xfs/297 > index ca482e06..07f84c25 100755 > --- a/tests/xfs/297 > +++ b/tests/xfs/297 > @@ -11,6 +11,17 @@ > . ./common/preamble > _begin_fstest auto freeze > > +# Override the default cleanup function. > +_cleanup() > +{ > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > + $KILLALL_PROG -q -9 $FSSTRESS_PROG > + wait > + cd / > + rm -f $tmp.* > +} > + > # Import common functions. > . ./common/filter > > diff --git a/tests/xfs/318 b/tests/xfs/318 > index be93f9ab..5798f9a3 100755 > --- a/tests/xfs/318 > +++ b/tests/xfs/318 > @@ -12,8 +12,9 @@ _begin_fstest auto quick rw freeze > # Override the default cleanup function. > _cleanup() > { > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > cd / > - _scratch_unmount > /dev/null 2>&1 > rm -rf $tmp.* > } > > diff --git a/tests/xfs/325 b/tests/xfs/325 > index c6861fbc..43fb09a6 100755 > --- a/tests/xfs/325 > +++ b/tests/xfs/325 > @@ -13,8 +13,9 @@ _begin_fstest auto quick clone freeze > # Override the default cleanup function. > _cleanup() > { > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > cd / > - _scratch_unmount > /dev/null 2>&1 > rm -rf $tmp.* > } > > diff --git a/tests/xfs/438 b/tests/xfs/438 > index cfe75bd8..0425c5b1 100755 > --- a/tests/xfs/438 > +++ b/tests/xfs/438 > @@ -26,6 +26,8 @@ _begin_fstest auto quick quota freeze > # Override the default cleanup function. > _cleanup() > { > + # Make sure $SCRATCH_MNT is unfreezed > + xfs_freeze -u $SCRATCH_MNT 2>/dev/null > [ -z "${interval}" ] || \ > sysctl -w fs.xfs.xfssyncd_centisecs=${interval} >/dev/null 2>&1 > cd / > -- > 2.25.1 >
diff --git a/tests/generic/068 b/tests/generic/068 index 56262cd7..eeddf6d1 100755 --- a/tests/generic/068 +++ b/tests/generic/068 @@ -17,9 +17,12 @@ ITERATIONS=10 # Override the default cleanup function. _cleanup() { - cd / - - trap 0 1 2 3 15 + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null + [ -n "$pid" ] && kill -9 $pid 2>/dev/null + wait $pid + cd / + rm -f $tmp.* } # Import common functions. @@ -60,6 +63,7 @@ touch $tmp.running rm -r $STRESS_DIR/* rmdir $STRESS_DIR } & +pid=$! # start fstest -m loop in a background block; this gets us mmap coverage { @@ -75,6 +79,7 @@ touch $tmp.running rm -rf $FSTEST_DIR/* rmdir $FSTEST_DIR } & +pid="$pid $!" i=0 let ITERATIONS=$ITERATIONS-1 @@ -103,6 +108,7 @@ done rm $tmp.running # wait for fsstresses to finish -wait +wait $pid +unset pid exit 1 diff --git a/tests/generic/085 b/tests/generic/085 index 20cf875a..786d8e6f 100755 --- a/tests/generic/085 +++ b/tests/generic/085 @@ -25,6 +25,8 @@ cleanup_dmdev() { # in case it's still suspended and/or mounted $DMSETUP_PROG resume $lvdev >/dev/null 2>&1 + [ -n "$pid" ] && kill -9 $pid 2>/dev/null + wait $pid $UMOUNT_PROG $lvdev >/dev/null 2>&1 _dmsetup_remove $node } @@ -75,6 +77,7 @@ done & pid="$pid $!" wait $pid +unset pid status=0 exit diff --git a/tests/generic/280 b/tests/generic/280 index 07144555..8e1ae4d2 100755 --- a/tests/generic/280 +++ b/tests/generic/280 @@ -10,6 +10,17 @@ . ./common/preamble _begin_fstest auto quota freeze +# Override the default cleanup function. +_cleanup() +{ + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null + [ -n "$pid" ] && kill -9 $pid 2>/dev/null + wait $pid + cd / + rm -f $tmp.* +} + # Import common functions. . ./common/filter . ./common/quota @@ -34,7 +45,7 @@ pid=$! sleep 1 xfs_freeze -u $SCRATCH_MNT wait $pid -_scratch_unmount +unset pid # Failure comes in the form of a deadlock. diff --git a/tests/generic/390 b/tests/generic/390 index 20c66e22..e8f6a5dc 100755 --- a/tests/generic/390 +++ b/tests/generic/390 @@ -14,8 +14,12 @@ _begin_fstest auto freeze stress _cleanup() { cd / - # Make sure $SCRATCH_MNT is unfreezed + # Kill freeze loops and make sure $SCRATCH_MNT is unfreezed + [ -n "$freeze_pids" ] && kill -9 $freeze_pids 2>/dev/null + wait $freeze_pids xfs_freeze -u $SCRATCH_MNT 2>/dev/null + [ -n "$fsstress_pid" ] && kill -9 $fsstress_pid 2>/dev/null + wait $fsstress_pid rm -f $tmp.* } @@ -62,7 +66,9 @@ done wait $fsstress_pid result=$? +unset fsstress_pid wait $freeze_pids +unset freeze_pids # Exit with fsstress return value status=$result diff --git a/tests/generic/459 b/tests/generic/459 index 57d58e55..7be39089 100755 --- a/tests/generic/459 +++ b/tests/generic/459 @@ -24,6 +24,8 @@ _begin_fstest auto freeze thin # Override the default cleanup function. _cleanup() { + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null cd / rm -f $tmp.* $UMOUNT_PROG $SCRATCH_MNT >>$seqres.full 2>&1 diff --git a/tests/generic/491 b/tests/generic/491 index e6e57dcd..797b08d5 100755 --- a/tests/generic/491 +++ b/tests/generic/491 @@ -12,6 +12,15 @@ . ./common/preamble _begin_fstest auto quick freeze mount +# Override the default cleanup function. +_cleanup() +{ + cd / + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null + rm -f $tmp.* +} + # Import common functions. . ./common/filter diff --git a/tests/xfs/011 b/tests/xfs/011 index d6e9099e..ed44d074 100755 --- a/tests/xfs/011 +++ b/tests/xfs/011 @@ -16,10 +16,11 @@ _begin_fstest auto freeze log metadata quick # Override the default cleanup function. _cleanup() { + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null $KILLALL_PROG -9 fsstress 2>/dev/null wait cd / - _scratch_unmount 2>/dev/null rm -f $tmp.* } diff --git a/tests/xfs/119 b/tests/xfs/119 index b6f96601..5ffbce25 100755 --- a/tests/xfs/119 +++ b/tests/xfs/119 @@ -11,6 +11,15 @@ . ./common/preamble _begin_fstest log v2log auto freeze +# Override the default cleanup function. +_cleanup() +{ + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null + cd / + rm -f $tmp.* +} + # Import common functions. . ./common/filter diff --git a/tests/xfs/297 b/tests/xfs/297 index ca482e06..07f84c25 100755 --- a/tests/xfs/297 +++ b/tests/xfs/297 @@ -11,6 +11,17 @@ . ./common/preamble _begin_fstest auto freeze +# Override the default cleanup function. +_cleanup() +{ + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null + $KILLALL_PROG -q -9 $FSSTRESS_PROG + wait + cd / + rm -f $tmp.* +} + # Import common functions. . ./common/filter diff --git a/tests/xfs/318 b/tests/xfs/318 index be93f9ab..5798f9a3 100755 --- a/tests/xfs/318 +++ b/tests/xfs/318 @@ -12,8 +12,9 @@ _begin_fstest auto quick rw freeze # Override the default cleanup function. _cleanup() { + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null cd / - _scratch_unmount > /dev/null 2>&1 rm -rf $tmp.* } diff --git a/tests/xfs/325 b/tests/xfs/325 index c6861fbc..43fb09a6 100755 --- a/tests/xfs/325 +++ b/tests/xfs/325 @@ -13,8 +13,9 @@ _begin_fstest auto quick clone freeze # Override the default cleanup function. _cleanup() { + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null cd / - _scratch_unmount > /dev/null 2>&1 rm -rf $tmp.* } diff --git a/tests/xfs/438 b/tests/xfs/438 index cfe75bd8..0425c5b1 100755 --- a/tests/xfs/438 +++ b/tests/xfs/438 @@ -26,6 +26,8 @@ _begin_fstest auto quick quota freeze # Override the default cleanup function. _cleanup() { + # Make sure $SCRATCH_MNT is unfreezed + xfs_freeze -u $SCRATCH_MNT 2>/dev/null [ -z "${interval}" ] || \ sysctl -w fs.xfs.xfssyncd_centisecs=${interval} >/dev/null 2>&1 cd /
Many of tests that freeze fs do not make sure that fs is unfrozen on test termination. Some tests also need to kill and wait for writer processes after unfreezing the fs. Signed-off-by: Amir Goldstein <amir73il@gmail.com> --- tests/generic/068 | 14 ++++++++++---- tests/generic/085 | 3 +++ tests/generic/280 | 13 ++++++++++++- tests/generic/390 | 8 +++++++- tests/generic/459 | 2 ++ tests/generic/491 | 9 +++++++++ tests/xfs/011 | 3 ++- tests/xfs/119 | 9 +++++++++ tests/xfs/297 | 11 +++++++++++ tests/xfs/318 | 3 ++- tests/xfs/325 | 3 ++- tests/xfs/438 | 2 ++ 12 files changed, 71 insertions(+), 9 deletions(-)