* [PATCH] tests: kill debugfs on interrupted MMP test
@ 2012-09-10 19:04 Andreas Dilger
[not found] ` <20120917011206.GA11666@thunk.org>
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Dilger @ 2012-09-10 19:04 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4, Andreas Dilger
If the f_mmp test is interrupted during its test run, then it can
leave debugfs busy-looping in the background. Since f_mmp is a
relatively long-running test, and is likely to be running during
a parallel test run, this can happen fairly often.
Set a signal trap for the f_mmp test script being killed, so that
the background debugfs command will always be killed by the test.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
---
tests/f_mmp/script | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tests/f_mmp/script b/tests/f_mmp/script
index 1b0ff79..c1f13fc 100644
--- a/tests/f_mmp/script
+++ b/tests/f_mmp/script
@@ -19,10 +19,18 @@ if [ "$status" != 0 ] ; then
return $status
fi
+kill_debugfs() {
+ trap 0
+ PID=$(ps -o pid,command | awk "/debugfs -w $TMPFILE/ { print \$1 }" |
+ grep -v awk)
+ [ "x$PID" != "x" ] && kill -9 $PID
+}
+
# this will cause debugfs to create the $test_name.mark file once it has
# passed the MMP startup, then continue reading input until it is killed
MARKFILE=$test_name.new
rm -f $MARKFILE
+trap kill_debugfs EXIT
echo "set mmp sequence to EXT2_MMP_SEQ_FSCK..." >> $test_name.log
( { echo dump_mmp; echo "dump_inode <2> $MARKFILE"; cat /dev/zero; } |
$DEBUGFS -w $TMPFILE >> $test_name.log 2>&1 & ) > /dev/null 2>&1 &
@@ -32,7 +40,7 @@ while [ ! -e $MARKFILE ]; do
done
rm -f $MARKFILE
echo "kill debugfs abruptly (simulates e2fsck failure) ..." >> $test_name.log
-killall -9 debugfs >> $test_name.log
+kill_debugfs
echo "e2fsck (should fail mmp_seq = EXT2_MMP_SEQ_FSCK) ..." >> $test_name.log
--
1.7.11.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: tests: kill debugfs on interrupted MMP test
[not found] ` <20120917011206.GA11666@thunk.org>
@ 2012-09-17 2:03 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2012-09-17 2:03 UTC (permalink / raw)
To: Andreas Dilger; +Cc: linux-ext4
On Sun, Sep 16, 2012 at 09:12:06PM -0400, Theodore Ts'o wrote:
> On Mon, Sep 10, 2012 at 09:04:47AM -0000, Andreas Dilger wrote:
> > If the f_mmp test is interrupted during its test run, then it can
> > leave debugfs busy-looping in the background. Since f_mmp is a
> > relatively long-running test, and is likely to be running during
> > a parallel test run, this can happen fairly often.
> >
> > Set a signal trap for the f_mmp test script being killed, so that
> > the background debugfs command will always be killed by the test.
> >
> > Signed-off-by: Andreas Dilger <adilger@dilger.ca>
>
> Thanks, applied.
Oops, I'm going to guess you didn't test your patch after making a
last minute change to it. I had to make the following change to the
f_mmp script to fix a problem where kill would complain about a
non-existing process id (because it was triyng to kill the already
exited awk process):
diff --git a/tests/f_mmp/script b/tests/f_mmp/script
index c1f13fc..d921672 100644
--- a/tests/f_mmp/script
+++ b/tests/f_mmp/script
@@ -21,8 +21,8 @@ fi
kill_debugfs() {
trap 0
- PID=$(ps -o pid,command | awk "/debugfs -w $TMPFILE/ { print \$1 }" |
- grep -v awk)
+ PID=$(ps -o pid,command | grep -v awk |
+ awk "/debugfs -w $TMPFILE/ { print \$1 }")
[ "x$PID" != "x" ] && kill -9 $PID
}
- Ted
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-17 2:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-10 19:04 [PATCH] tests: kill debugfs on interrupted MMP test Andreas Dilger
[not found] ` <20120917011206.GA11666@thunk.org>
2012-09-17 2:03 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).