From patchwork Thu Apr 6 13:19:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 9667257 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 A782F6021C for ; Thu, 6 Apr 2017 13:19:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B93C526E56 for ; Thu, 6 Apr 2017 13:19:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE28028179; Thu, 6 Apr 2017 13:19:23 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22D432823D for ; Thu, 6 Apr 2017 13:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753213AbdDFNTV (ORCPT ); Thu, 6 Apr 2017 09:19:21 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35844 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933187AbdDFNTS (ORCPT ); Thu, 6 Apr 2017 09:19:18 -0400 Received: by mail-lf0-f66.google.com with SMTP id n78so3638445lfi.3; Thu, 06 Apr 2017 06:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dl48QUniTUVjLTWxUE6iyeBKv8twrNRzTH9gR1n2TV4=; b=MXawCh9u35NWt5f2Izknz6Fh0fUkSj5gxN/kmJ3CXGmTaThxyuQOm8ThpkrQjXt0Um mmHjCm4oqiktpFZ3a09hvBrv0Ql4GbnrrkB69XKhjrPMcp47Hf1K5f2CPB60mMBECiAG +BgYhkZxZTztwWfYULa7FcaUIrr1Md7cTfZDgeyJBNfSQP+kGyIqCgukHZQ95/G/UPSV ibw2/bDruzNPnu0tjY8EJ0ZkucR+WEuiPtCfNHl2R0SfLozAgB4iMavy3JS+XDUD3JiF e7v8VkN/CUY61xFYM1Zr8bsxnNUtDYWb3piRvISQds8niS6dK7TqiUGWYGgp7TGafnuO 3FgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dl48QUniTUVjLTWxUE6iyeBKv8twrNRzTH9gR1n2TV4=; b=ZYob3RVDthgJBQeMGnWAlRGJ5i6TPSS6fNTX2hDeA4YCTKvZAI3h/8CX7QruSA3H5d N2rb073QiDvCpyMRyrTA78w3dox4ZvUOaeZ2GUMD0Q8RmLW3pEaAG2Y12qH7+pBg34wl fGZgkzDKZVnvpA2kEznl2f2bBREvEYhSrOMNTq2JnQNE7xIhOn0ObP2KDUKgrByKQKY3 8tfraF+XYjSpqF8Dx53AW/gPzMAdyY11lUP+bz21Ew6q02QOfXreTMiRkEwfF7WvfwRW x3XepBzmpD7CaHpbNitqMSiDC94xbN34hhNqkc3m5P3Q/bNKI6Mk7SUlltbV/WUwv2kB 6vtw== X-Gm-Message-State: AFeK/H13pmmn14Bdw/bg2UqlhtDYMREayEf+uPVxC4OabcIeEa5aL7fsZx7nm/IuTjSmwg== X-Received: by 10.25.80.82 with SMTP id z18mr9588845lfj.99.1491484755670; Thu, 06 Apr 2017 06:19:15 -0700 (PDT) Received: from smtp.gmail.com (msk-vpn.virtuozzo.com. [195.214.232.6]) by smtp.gmail.com with ESMTPSA id r12sm334836lfr.60.2017.04.06.06.19.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:19:15 -0700 (PDT) From: Dmitry Monakhov To: fstests@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, Dmitry Monakhov Subject: [PATCH 2/6] add: blockdev/001 check page-cache coherency after BLKDISCARD Date: Thu, 6 Apr 2017 17:19:06 +0400 Message-Id: <1491484750-9164-3-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1491484750-9164-1-git-send-email-dmonakhov@openvz.org> References: <1491484750-9164-1-git-send-email-dmonakhov@openvz.org> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Regression test for fix https://lkml.org/lkml/2017/3/22/789 Page cache should be dropped after successful discard Signed-off-by: Dmitry Monakhov --- common/config | 1 + tests/blockdev/001 | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/blockdev/001.out | 7 +++++ tests/blockdev/group | 6 ++++ 4 files changed, 88 insertions(+) create mode 100755 tests/blockdev/001 create mode 100644 tests/blockdev/001.out create mode 100644 tests/blockdev/group diff --git a/common/config b/common/config index cfe7913..aef842c 100644 --- a/common/config +++ b/common/config @@ -199,6 +199,7 @@ export LOGGER_PROG="`set_prog_path logger`" export DBENCH_PROG="`set_prog_path dbench`" export DMSETUP_PROG="`set_prog_path dmsetup`" export WIPEFS_PROG="`set_prog_path wipefs`" +export BLKDISCARD_PROG="`set_prog_path blkdiscard`" export DUMP_PROG="`set_prog_path dump`" export RESTORE_PROG="`set_prog_path restore`" export LVM_PROG="`set_prog_path lvm`" diff --git a/tests/blockdev/001 b/tests/blockdev/001 new file mode 100755 index 0000000..53b0664 --- /dev/null +++ b/tests/blockdev/001 @@ -0,0 +1,74 @@ +#! /bin/bash +# FS QA Test 001 +# +# Regression test for fix https://lkml.org/lkml/2017/3/22/789 +# Page cache should be dropped after successful discard +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Dmitry Monakhov +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/scsi_debug + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scsi_debug +_require_command $BLKDISCARD_PROG blkdiscard + + +# Create virtual device with unmap_zeroes_data support +dev=$(_get_scsi_debug_dev 512 512 0 32 "lbpws=1 lbpws10=1") + +# Initialize data with known pattern +$XFS_IO_PROG -c "pwrite -S 0xaa -b 2M 0 32M -w" -d $dev >>$seqres.full 2>&1 || \ + _fail "pwrite failed" + +# Fill page cache with dirty data +$XFS_IO_PROG -c "pwrite -S 0xbb -b 2M 2M 10M" -f $dev >>$seqres.full 2>&1 || \ + _fail "pwrite failed" + +$BLKDISCARD_PROG $dev +# After device was fully discarded, read sould return all zeroes +dd if=$dev bs=4k 2>>$seqres.full | hexdump +dd if=$dev bs=4M iflag=direct 2>>$seqres.full | hexdump +# success, all done +status=0 +exit diff --git a/tests/blockdev/001.out b/tests/blockdev/001.out new file mode 100644 index 0000000..0f81a92 --- /dev/null +++ b/tests/blockdev/001.out @@ -0,0 +1,7 @@ +QA output created by 001 +0000000 0000 0000 0000 0000 0000 0000 0000 0000 +* +2000000 +0000000 0000 0000 0000 0000 0000 0000 0000 0000 +* +2000000 diff --git a/tests/blockdev/group b/tests/blockdev/group new file mode 100644 index 0000000..bdfdcb9 --- /dev/null +++ b/tests/blockdev/group @@ -0,0 +1,6 @@ +# QA groups control file +# Defines test groups and nominal group owners +# - do not start group names with a digit +# - comment line before each group is "new" description +# +001 rw blockdev