From patchwork Fri Sep 28 14:50:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 10620099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 519C6112B for ; Fri, 28 Sep 2018 14:51:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41C3E2B9E8 for ; Fri, 28 Sep 2018 14:51:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35E3C2B9F2; Fri, 28 Sep 2018 14:51:21 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 ADCAC2B9C0 for ; Fri, 28 Sep 2018 14:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbeI1VP1 (ORCPT ); Fri, 28 Sep 2018 17:15:27 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:49186 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbeI1VP1 (ORCPT ); Fri, 28 Sep 2018 17:15:27 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8SEmoeT156963; Fri, 28 Sep 2018 14:51:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=pRpX/YcvQipMweR0GPY9H5ttd+z2dVP7a2L+m8fwKKU=; b=kYnvEAzzbglqdV7+hXB3df385cKX97i4RwQkflLlL4wGnCxdekJf/YJHAVwLdcN+88Ba WlSfMTHxMG3nLMJSwcoxk4Q9kQfFjU+OH5kimwL8jVfCeYe+LVGXJlyFHcQDAjaeEgbr V7Ihj3ecuNFGO0OST3Jg5bw5LEa2d5PGYhZFceidel7PrCps36aPJIaHgb2VLInNMZoc /fP9ZBwaD4a902aMGEfxMrm2yviNhmamjYEdSODSeS4fWqYvIbrb5pivBJCYxPXXk7JZ caFG0TFQTuU/Muev8injKYD3XqDOiHPWOu0drpjcc3mje5z001ye5KKDy30SNuXjfS3H og== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2mnvtv7fhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Sep 2018 14:51:18 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w8SEpHGr022543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Sep 2018 14:51:17 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8SEpHFJ012720; Fri, 28 Sep 2018 14:51:17 GMT Received: from tpasj.localdomain (/202.156.138.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 28 Sep 2018 14:51:17 +0000 From: Anand Jain To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH v3] test unaligned punch hole at ENOSPC Date: Fri, 28 Sep 2018 22:50:48 +0800 Message-Id: <1538146248-1759-1-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9029 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809280150 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Try to punch hole with unaligned size and offset when the FS returns ENOSPC Signed-off-by: Anand Jain --- v2->v3: add _require_xfs_io_command "fpunch" add more logs to $seqfull.full mount options and group profile info add sync after dd upto ENOSPC drop fallocate -p and use xfs_io punch to create holes v1->v2: Use at least 256MB to test. This test case fails on btrfs as of now. tests/btrfs/172 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/172.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 77 insertions(+) create mode 100755 tests/btrfs/172 create mode 100644 tests/btrfs/172.out diff --git a/tests/btrfs/172 b/tests/btrfs/172 new file mode 100755 index 000000000000..59413a5de12f --- /dev/null +++ b/tests/btrfs/172 @@ -0,0 +1,74 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Oracle. All Rights Reserved. +# +# FS QA Test 172 +# +# Test if the unaligned (by size and offset) punch hole is successful when FS +# is at ENOSPC. +# +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 + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_xfs_io_command "fpunch" + +_scratch_mkfs_sized $((256 * 1024 *1024)) >> $seqres.full + +# max_inline helps to create regular extent +_scratch_mount "-o max_inline=0,nodatacow" + +cat /proc/self/mounts | grep $SCRATCH_DEV >> $seqres.full +$BTRFS_UTIL_PROG filesystem df $SCRATCH_MNT >> $seqres.full + +extent_size=$(_scratch_btrfs_sectorsize) +unalign_by=512 +echo extent_size=$extent_size unalign_by=$unalign_by >> $seqres.full + +$XFS_IO_PROG -f -d -c "pwrite -S 0xab 0 $((extent_size * 10))" \ + $SCRATCH_MNT/testfile >> $seqres.full + +echo "Fill fs upto ENOSPC" >> $seqres.full +dd status=none if=/dev/zero of=$SCRATCH_MNT/filler bs=512 >> $seqres.full 2>&1 +sync + +hole_offset=0 +hole_len=$unalign_by +$XFS_IO_PROG -f -d -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile + +hole_offset=$(($extent_size + $unalign_by)) +hole_len=$(($extent_size - $unalign_by)) +$XFS_IO_PROG -f -d -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile + +hole_offset=$(($extent_size * 2 + $unalign_by)) +hole_len=$(($extent_size * 5)) +$XFS_IO_PROG -f -d -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/btrfs/172.out b/tests/btrfs/172.out new file mode 100644 index 000000000000..ce2de3f0d107 --- /dev/null +++ b/tests/btrfs/172.out @@ -0,0 +1,2 @@ +QA output created by 172 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index feffc45b6564..7e1a638ab7e1 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -174,3 +174,4 @@ 169 auto quick send 170 auto quick snapshot 171 auto quick qgroup +172 auto quick