From patchwork Fri Nov 17 20:28:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Zwisler X-Patchwork-Id: 10063711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 95F2D601D3 for ; Fri, 17 Nov 2017 20:28:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87D012A188 for ; Fri, 17 Nov 2017 20:28:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CAD62A190; Fri, 17 Nov 2017 20:28:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 360A92A188 for ; Fri, 17 Nov 2017 20:28:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 02AA320349DB1; Fri, 17 Nov 2017 12:24:27 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=ross.zwisler@linux.intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 621B820349D90 for ; Fri, 17 Nov 2017 12:24:25 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Nov 2017 12:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,411,1505804400"; d="scan'208";a="6247051" Received: from theros.lm.intel.com ([10.232.112.77]) by orsmga001.jf.intel.com with ESMTP; 17 Nov 2017 12:28:35 -0800 From: Ross Zwisler To: fstests Subject: [fstests PATCH v4 2/4] dm-log-writes: only replay log to marks that exist Date: Fri, 17 Nov 2017 13:28:26 -0700 Message-Id: <20171117202828.25472-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171117202828.25472-1-ross.zwisler@linux.intel.com> References: <20171117202828.25472-1-ross.zwisler@linux.intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , linux-nvdimm , Amir Goldstein , Dave Chinner , linux-xfs MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- common/dmlogwrites | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/dmlogwrites b/common/dmlogwrites index 247c744..80ed4fc 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 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"