aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Zwisler <ross.zwisler@linux.intel.com>2017-12-05 17:37:43 -0700
committerEryu Guan <eguan@redhat.com>2017-12-08 12:25:53 +0800
commit1475bdd1f7b6cd434a6e1f8439b2a8a21111942a (patch)
tree527996098bda00338eda586c8ee260a2191a19fa
parent0920e161034a5674a1de8fbdbb505f08c89e10d7 (diff)
downloadxfstests-1475bdd1f7b6cd434a6e1f8439b2a8a21111942a.tar.gz
dm-log-writes: only replay log to marks that exist
The 'replay-log' executable will replay the dm-log-writes log until the given mark, or until the end of the log if the mark isn't found. This means that if the mark you're looking for was never inserted in the log or if you give garbage to _log_writes_replay_log() the entire log will be replayed. This can cause unexpected test results. Fix this by making sure that the mark we're given actually exists in the log before we allow the replay. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
-rw-r--r--common/dmlogwrites4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/dmlogwrites b/common/dmlogwrites
index 247c744238..05829dbc0a 100644
--- a/common/dmlogwrites
+++ b/common/dmlogwrites
@@ -72,6 +72,10 @@ _log_writes_replay_log()
{
_mark=$1
+ $here/src/log-writes/replay-log --log $LOGWRITES_DEV --find \
+ --end-mark $_mark >> $seqres.full 2>&1
+ [ $? -ne 0 ] && _fail "mark '$_mark' does not exist"
+
$here/src/log-writes/replay-log --log $LOGWRITES_DEV --replay $SCRATCH_DEV \
--end-mark $_mark >> $seqres.full 2>&1
[ $? -ne 0 ] && _fail "replay failed"