All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: fstests <fstests@vger.kernel.org>, Eryu Guan <eguan@redhat.com>
Cc: Jan Kara <jack@suse.cz>, linux-nvdimm <linux-nvdimm@lists.01.org>,
	Amir Goldstein <amir73il@gmail.com>,
	Dave Chinner <david@fromorbit.com>,
	linux-xfs <linux-xfs@vger.kernel.org>
Subject: [fstests PATCH v5 1/2] dm-log-writes: only replay log to marks that exist
Date: Tue,  5 Dec 2017 17:37:43 -0700	[thread overview]
Message-ID: <20171206003744.28587-2-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20171206003744.28587-1-ross.zwisler@linux.intel.com>

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>
---
 common/dmlogwrites | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/dmlogwrites b/common/dmlogwrites
index 247c7442..05829dbc 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"
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: fstests <fstests@vger.kernel.org>, Eryu Guan <eguan@redhat.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	linux-nvdimm <linux-nvdimm@lists.01.org>, Jan Kara <jack@suse.cz>,
	Dave Chinner <david@fromorbit.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Amir Goldstein <amir73il@gmail.com>
Subject: [fstests PATCH v5 1/2] dm-log-writes: only replay log to marks that exist
Date: Tue,  5 Dec 2017 17:37:43 -0700	[thread overview]
Message-ID: <20171206003744.28587-2-ross.zwisler@linux.intel.com> (raw)
In-Reply-To: <20171206003744.28587-1-ross.zwisler@linux.intel.com>

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>
---
 common/dmlogwrites | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/dmlogwrites b/common/dmlogwrites
index 247c7442..05829dbc 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"
-- 
2.14.3


  reply	other threads:[~2017-12-06  0:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06  0:37 [fstests PATCH v5 0/2] add test for DAX MAP_SYNC support Ross Zwisler
2017-12-06  0:37 ` Ross Zwisler
2017-12-06  0:37 ` Ross Zwisler [this message]
2017-12-06  0:37   ` [fstests PATCH v5 1/2] dm-log-writes: only replay log to marks that exist Ross Zwisler
2017-12-06 12:53   ` Amir Goldstein
2017-12-06 12:53     ` Amir Goldstein
2017-12-06  0:37 ` [fstests PATCH v5 2/2] generic: add test for DAX MAP_SYNC support Ross Zwisler
2017-12-06  0:37   ` Ross Zwisler
2017-12-06 13:41   ` Amir Goldstein
2017-12-06 13:41     ` Amir Goldstein
2017-12-07 10:36   ` Eryu Guan
2017-12-07 10:36     ` Eryu Guan
2017-12-07 22:58     ` Ross Zwisler
2017-12-07 22:58       ` Ross Zwisler
2017-12-07 23:19     ` [fstests PATCH v6 " Ross Zwisler
2017-12-07 23:19       ` Ross Zwisler
2017-12-08  6:36       ` Eryu Guan
2017-12-08  6:36         ` Eryu Guan
2017-12-08 17:47         ` Ross Zwisler
2017-12-08 17:47           ` Ross Zwisler
2017-12-10  6:15           ` Eryu Guan
2017-12-10  6:15             ` Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206003744.28587-2-ross.zwisler@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=amir73il@gmail.com \
    --cc=david@fromorbit.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.