From patchwork Thu May 10 06:21:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10391265 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 8E9AD60153 for ; Thu, 10 May 2018 06:22:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CFF928891 for ; Thu, 10 May 2018 06:22:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70FDC288B2; Thu, 10 May 2018 06:22:03 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, 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 0BBDE28891 for ; Thu, 10 May 2018 06:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934040AbeEJGWC (ORCPT ); Thu, 10 May 2018 02:22:02 -0400 Received: from mail-pl0-f47.google.com ([209.85.160.47]:41220 "EHLO mail-pl0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751313AbeEJGWB (ORCPT ); Thu, 10 May 2018 02:22:01 -0400 Received: by mail-pl0-f47.google.com with SMTP id az12-v6so691043plb.8 for ; Wed, 09 May 2018 23:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=KDjWAf2nsI/+hmczFqL+Zgbdv/KwRKiYe7qH3ZHfkZg=; b=1f2DdiK6QpVuTFNCDNIO5xfvBw9ohwySmbirq6S7wjbnlrIUUAJIEUfscvdMgsZbCa 5Btw32+HJa3WV6+Ndbz6LMOkAVDaWMT63pTqkFm5UTg4Nw8eiR/cb2o0Nh0otvkG5G6b UeWiQrKrHH9NgI1BtG8GariQraYbm3Mcnr5RCoQsWeEsvWeP4xRPhqKOEEeEEp6gIG/u rfoklUd06PoitNNJs5x4QBivsSZMfVFPgpF0r/HR2VBbvgKbW4PbN0kbEOuA4K4XF4jx SjKC44b2lUOwycWLdNrft27c47+60two5bgI+l3D+D/Whhg0pxGdZ92mJPsoYcFJGYWA vWrg== 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=KDjWAf2nsI/+hmczFqL+Zgbdv/KwRKiYe7qH3ZHfkZg=; b=C20H6zr3UfItSo/EEh7h87o+Zk9LqMCHZWRML8RKqo7tnZaDegB9bvhfO2g6Wg5wzO aZccLSQ9qLgqy0GJ3pYTOv3dAPTdkbHhPiFLaJdjYpRLDCNPCYpHRYr09Z6yvq4KUUun XVFmvxaKeys7v8UCWnqXOYsbsqo4/6CrRqnMYnEkaj5hV9lYVuyFhQawdM2T2KM92c8j qDRj+fuCXLam3MbdQ1a+OgNrwfwucCIw/5cqsUF8FPzEgh/23EhRczlH+PvWS1/XPo0p NDtzUlDsfgYp17vkMIpr8fmpQs0Z+oVqXZ7vurNtV3NYl3mRPTjU3ureROkHCKOCtH8f 8RtQ== X-Gm-Message-State: ALKqPwcRXTcVdu0LtURADPLUiSVqI3DBWnh9FltQaoHKm0fpVkUUd4dg dADk/rIKDJwE60nRVsur/ltz5pFuTgE= X-Google-Smtp-Source: AB8JxZrc4wc4LLCQI84nbTTQdFretXi/+yXOrLcSyoxWONazp8QsVwe3MduGYjWH3dEIA32fLfzrSw== X-Received: by 2002:a17:902:2c83:: with SMTP id n3-v6mr148536plb.140.1525933320963; Wed, 09 May 2018 23:22:00 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:65fc]) by smtp.gmail.com with ESMTPSA id h1-v6sm175631pfg.135.2018.05.09.23.21.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 23:22:00 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org, Eryu Guan Cc: kernel-team@fb.com Subject: [PATCH] btrfs: test ENOSPC caused by many orphan items Date: Wed, 9 May 2018 23:21:55 -0700 Message-Id: X-Mailer: git-send-email 2.17.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval Btrfs has a bug where we can prematurely ENOSPC if we have lots of orphaned files, i.e., deleted files which are still open. Add a test which repeatedly creates and deletes a file while keeping all of the file descriptors open. This should succeed but doesn't on Btrfs without the fix. Signed-off-by: Omar Sandoval --- tests/generic/479 | 0 tests/generic/487 | 65 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/487.out | 2 ++ tests/generic/group | 1 + 4 files changed, 68 insertions(+) mode change 100644 => 100755 tests/generic/479 create mode 100755 tests/generic/487 create mode 100644 tests/generic/487.out diff --git a/tests/generic/479 b/tests/generic/479 old mode 100644 new mode 100755 diff --git a/tests/generic/487 b/tests/generic/487 new file mode 100755 index 00000000..66379cf0 --- /dev/null +++ b/tests/generic/487 @@ -0,0 +1,65 @@ +#! /bin/bash +# FS QA Test 487 +# +# Test having many file descriptors referring to deleted files open. Regression +# test for patch "Btrfs: fix ENOSPC caused by orphan items reservations". +# +#----------------------------------------------------------------------- +# Copyright (c) 2018 Omar Sandoval. 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.* +} + +. ./common/rc +. ./common/filter + +rm -f $seqres.full + +_supported_fs generic +_supported_os Linux +_require_scratch + +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount + +test_file="$SCRATCH_MNT/$seq" + +( +ulimit -n $((16 * 1024)) +# ~10000 files on a 1 GB filesystem should be no problem. +for ((i = 1000; i < 10000; i++)); do + eval "exec $i<> \"$test_file\"" && rm "$test_file" || break +done +) + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/generic/487.out b/tests/generic/487.out new file mode 100644 index 00000000..5f31fd97 --- /dev/null +++ b/tests/generic/487.out @@ -0,0 +1,2 @@ +QA output created by 487 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index 505383f7..93581257 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -489,3 +489,4 @@ 484 auto quick 485 auto quick insert 486 auto quick attr +487 auto quick