From patchwork Thu Apr 6 13:19:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 9667269 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 19CDC6021C for ; Thu, 6 Apr 2017 13:19:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F14426E56 for ; Thu, 6 Apr 2017 13:19:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23CEC26E4E; Thu, 6 Apr 2017 13:19:28 +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 B044E26E4E for ; Thu, 6 Apr 2017 13:19:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933859AbdDFNT0 (ORCPT ); Thu, 6 Apr 2017 09:19:26 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35863 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933835AbdDFNTW (ORCPT ); Thu, 6 Apr 2017 09:19:22 -0400 Received: by mail-lf0-f67.google.com with SMTP id n78so3638595lfi.3; Thu, 06 Apr 2017 06:19:21 -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=9/jbGmtqwFoctD3o2xX1oS21uwo0HMtn1ZyNSZHFZEE=; b=JAwuqT9mDnbAU0a4seila9cm+F+fVumhtRZ+O9Xy61oW14NbX8lFX6zjsb0FbAa1oL x+fUWV0pLw7XOfIEcw6/+wHn9QNbGMd/go6thye1YDYMuWdu2ShBvjEXasYoiw34CLze NHJXK+XfJ3IeOH5viIgdddQrgh18Ak+4ja7RN7T/YVpu7UiJRFjkmWI7UZCh/HAua1yY 1dldqON/n4wNEmRC1rt7AN2I6b1n3ac9kOtnw0nZGA9iLH5UCCERrzKW0ZqGm3r/RQtW mCorDgJvj4bJsm0AigiiqFDDCIKV6MNa8ydgl2MazIcQIH8ApduOosIyyJfDbsyo1t39 e1Dw== 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=9/jbGmtqwFoctD3o2xX1oS21uwo0HMtn1ZyNSZHFZEE=; b=USjX8ejt34B07WciEUUxdcXF3uECqwfe5Su7v5E9lkPGviKAc4S7/OycZjEfaU7MUV t6SlNVduh1iIP5lrM1/vQkUZzADM/uNFWn5plalIVG/wvypNX8rX8FclaQDpbGfCmYBh Kk5Gwc6dXwCgkfTjjWiVZmRpmLYYluiH6vnMME6J65lUnfDs5sWCmnEaOKXSSiK9YK/p D6PgEuhw1D/iYB7rYc95QJJD19seVOfHyXIYrSgmhkBeztF1HLAMQdjL+W2PuCBf1Ztk 8I4r+6i7lOEp6BFG4ntEe0HSzfj1V3FiIdrNc+5Nl6EHyyA1gHUhMOrvA4itk5tH28mL zjVg== X-Gm-Message-State: AFeK/H0zJ5z9UZquXZLKmZXLFmJzDHTVhx2CYpDX5dd55qcw8mrhYPOdPXV5GyL7PrEJHw== X-Received: by 10.25.115.144 with SMTP id h16mr10503824lfk.46.1491484759398; Thu, 06 Apr 2017 06:19:19 -0700 (PDT) Received: from smtp.gmail.com (msk-vpn.virtuozzo.com. [195.214.232.6]) by smtp.gmail.com with ESMTPSA id 9sm343423ljt.25.2017.04.06.06.19.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:19:18 -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 5/6] new: blockdev/004 Check that live fs survives blkdev page truncation Date: Thu, 6 Apr 2017 17:19:09 +0400 Message-Id: <1491484750-9164-6-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 Signed-off-by: Dmitry Monakhov --- tests/blockdev/004 | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/blockdev/004.out | 2 ++ tests/blockdev/group | 1 + 3 files changed, 84 insertions(+) create mode 100755 tests/blockdev/004 create mode 100644 tests/blockdev/004.out diff --git a/tests/blockdev/004 b/tests/blockdev/004 new file mode 100755 index 0000000..decb4ad --- /dev/null +++ b/tests/blockdev/004 @@ -0,0 +1,81 @@ +#! /bin/bash +# FS QA Test 004 +# +# Check that live filesystem survives blockdev pagecache truncation. +# blkdev page cache can be truncated due to various reasons +# 1)ioctl: BLKDISCARD +# 2)blkdev: falloc{ FALLOC_FL_ZERO_RANGE, FALLOC_FL_PUNCH_HOLE } +# 3)nbd: NBD_CLEAR_SOCK +# +#----------------------------------------------------------------------- +# 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() +{ + $UMOUNT_PROG $fs_mnt + _destroy_loop_device $loop_dev + cd / + rm -rf $TEST_DIR/$$ + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_loop + +# create the fs image and mount point + +mkdir -p $TEST_DIR/$$ || _fail "Can not make test dir" +fs_img=$TEST_DIR/$$/fs.img +fs_mnt=$TEST_DIR/$$/mnt +$XFS_IO_PROG -fc "truncate 1g" $fs_img >>$seqres.full 2>&1 +mkdir -p $fs_mnt +loop_dev=$(_create_loop_device $fs_img) +_mkfs_dev $loop_dev +_mount $loop_dev $fs_mnt + +# Issue zeroout on block device, this act just a giant hammer for fs, +# A lot of complains are expected, bug_on/panic is not. +$XFS_IO_PROG -c "fzero -k 0 1G" -f $loop_dev >>$seqres.full 2>&1 +# Try IO on corrupted fs +for ((i=0;i<1000;i++));do + $XFS_IO_PROG -fc "pwrite -S $i 0 16k" $fs_mnt/test-$i >>$seqres.full 2>&1 +done +$XFS_IO_PROG -fc "fsync" $fs_mnt/test-0 >>$seqres.full 2>&1 + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/blockdev/004.out b/tests/blockdev/004.out new file mode 100644 index 0000000..af8614a --- /dev/null +++ b/tests/blockdev/004.out @@ -0,0 +1,2 @@ +QA output created by 004 +Silence is golden diff --git a/tests/blockdev/group b/tests/blockdev/group index e5ce864..d100c85 100644 --- a/tests/blockdev/group +++ b/tests/blockdev/group @@ -6,3 +6,4 @@ 001 rw blockdev 002 rw blockdev liotarget 003 rw blockdev liotarget integrity dangerous +004 rw blockdev dangerous zero