From patchwork Mon Oct 30 22:33:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Maggard X-Patchwork-Id: 10033361 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 B67946039A for ; Mon, 30 Oct 2017 22:34:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A887C288A2 for ; Mon, 30 Oct 2017 22:34:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D90528986; Mon, 30 Oct 2017 22:34:05 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 445A5288A2 for ; Mon, 30 Oct 2017 22:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753410AbdJ3WeA (ORCPT ); Mon, 30 Oct 2017 18:34:00 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:46772 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753389AbdJ3Wd5 (ORCPT ); Mon, 30 Oct 2017 18:33:57 -0400 Received: by mail-pg0-f44.google.com with SMTP id k7so12908811pga.3; Mon, 30 Oct 2017 15:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=uVZb3rZulAmrax2wnba2oQIsG3xhiQcMWKWumUfVndY=; b=mFGVRT65qpYn7mROinSGyqgOyql/4TZu2Hy3vmmVM0reu8KHBqq8Z2I0fffBYTgcox RBAA+kdHgqKoiLdGlcHsNS+mkTtk38P83SBlDgWT3W8VSMsUC2khKGmuHpQ0g95zEA6b EfapdYUbn63SBRAkdI84FnQImkKPuc/yyBchHRP+gjlRWf8QzNK6WAwxAsIEBv6qzuE6 /mK6yx81X/hOOjZcZnKITIIxRlJKNjt8B5nW24gg51aDsfMUDnKCwuQicOeHVszlbctg G+g69v2IAi3Rz0VntoGHBXwtmgWD4qAnVfYU5OGB9RiQcTMr2ASKX7IU3b4qBy7dvpIP ckFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uVZb3rZulAmrax2wnba2oQIsG3xhiQcMWKWumUfVndY=; b=jAwanX2Z0bmYq97YljyniXorQhhEA4t6q6CPSR1AFhxTf2dnW6tfPOdQ3b+UDOHOF5 GvWHeo/ElW8n+ozdR9c9d/rFJM7153vF3k5vLgfw5G8QL5zlCAVUXC2CnM2x2InmARpz aOXr1sQ5F7TPS6OKzciJXngt52y0bu436tPKgGcFpLIT7O/3nZLdk1gaoP1/I81Ajnn0 Lb2JfLsCJUra3T68L+y6zmxIXYEFa8G1zHj3kEFamIoLizKwaKvzDLdLqQs0xuCjWuq6 Z8sspU1ayWmF0me2ZoSYxd9ba8/IXJ8ZTT1QTMLdK2j3bWQ2eY0TJtAKSgckW3BWPotB 1hZw== X-Gm-Message-State: AMCzsaVAYD9B5zzgOR88/13Brkb8CfrW+P82tJb/WTHVT6JpVXhZCRv/ 5PIRbEEdMXLvInVm8vARRoJ2E5Y7 X-Google-Smtp-Source: ABhQp+T5ZhQRBf77mVjAGeUMz3EGw+snAiQmu1PaAKigG4Cm8tTaJszoTQjjc+d30dseGoPSZ6yd3Q== X-Received: by 10.84.240.12 with SMTP id y12mr8495033plk.249.1509402836476; Mon, 30 Oct 2017 15:33:56 -0700 (PDT) Received: from jmaggard-thinkpad-t450s.infrant-6.com (198-0-192-140-static.hfc.comcastbusiness.net. [198.0.192.140]) by smtp.gmail.com with ESMTPSA id r78sm9062pfb.29.2017.10.30.15.33.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Oct 2017 15:33:55 -0700 (PDT) From: Justin Maggard X-Google-Original-From: Justin Maggard To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org Cc: Justin Maggard Subject: [PATCH] btrfs: test for qgroup reservation leaks with prealloc Date: Mon, 30 Oct 2017 15:33:48 -0700 Message-Id: <20171030223348.22018-1-jmaggard@netgear.com> X-Mailer: git-send-email 2.14.2 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test case writes into pre-allocated space, then tries to fallocate some more within the defined quota limit. Currently (4.14-rc7) this fails with EDQUOT due to quota reservation leakage when writing into pre- allocated space. A possible fix has been sent to the ML as "btrfs: Fix quota reservation leak on preallocated files" Signed-off-by: Justin Maggard --- tests/btrfs/153 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/153.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 75 insertions(+) create mode 100755 tests/btrfs/153 create mode 100644 tests/btrfs/153.out diff --git a/tests/btrfs/153 b/tests/btrfs/153 new file mode 100755 index 0000000..95a8095 --- /dev/null +++ b/tests/btrfs/153 @@ -0,0 +1,72 @@ +#! /bin/bash +# FS QA Test 153 +# +# Test for leaking quota reservations on preallocated files. +# +#----------------------------------------------------------------------- +# +# Copyright (c) 2017 NETGEAR, Inc. 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 + +# 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_btrfs_qgroup_report +_require_xfs_io_command "falloc" + +_scratch_mkfs >/dev/null +_scratch_mount + +_run_btrfs_util_prog quota enable $SCRATCH_MNT +_run_btrfs_util_prog quota rescan -w $SCRATCH_MNT +_run_btrfs_util_prog qgroup limit 100M 0/5 $SCRATCH_MNT + +testfile1=$SCRATCH_MNT/testfile1 +testfile2=$SCRATCH_MNT/testfile2 +$XFS_IO_PROG -fc "falloc 0 80M" $testfile1 +$XFS_IO_PROG -fc "pwrite 0 80M" $testfile1 > /dev/null +$XFS_IO_PROG -fc "falloc 0 19M" $testfile2 +$XFS_IO_PROG -fc "pwrite 0 19M" $testfile2 > /dev/null + +echo "Silence is golden" +status=0 +exit diff --git a/tests/btrfs/153.out b/tests/btrfs/153.out new file mode 100644 index 0000000..cd9fe8a --- /dev/null +++ b/tests/btrfs/153.out @@ -0,0 +1,2 @@ +QA output created by 153 +Silence is golden diff --git a/tests/btrfs/group b/tests/btrfs/group index fb94461..15c2ecb 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -155,3 +155,4 @@ 150 auto quick dangerous 151 auto quick 152 auto quick metadata qgroup send +153 auto quick qgroup