From patchwork Wed May 16 20:38:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10404809 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 A3648601D2 for ; Wed, 16 May 2018 20:39:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93428286F8 for ; Wed, 16 May 2018 20:39:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 881362870D; Wed, 16 May 2018 20:39:07 +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 1F113286F8 for ; Wed, 16 May 2018 20:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751255AbeEPUjG (ORCPT ); Wed, 16 May 2018 16:39:06 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:45041 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbeEPUjA (ORCPT ); Wed, 16 May 2018 16:39:00 -0400 Received: by mail-pg0-f67.google.com with SMTP id c22-v6so117886pgn.11 for ; Wed, 16 May 2018 13:39:00 -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:in-reply-to:references :in-reply-to:references; bh=opOg5hr9zGeOQy3sjr/lwSe5+VCb/5vQ408xrxqOqx4=; b=cdG2Gwu5qRsEL78viVTwkxoJZ1JenxKEHzsMjowBTnxOdMUq0X6rQZypta2ApFmlmu LvUdBMdTsLvfMBILHErFHK3w+gMIJZWefLpOOaoF9Ee8JuceUQleeomj8kzqyORLfXro I6QdOQ4MIn40mKj96Oc6+b3CYDGnHiKEZkxS+OAUTScJb7BE/ZBuYUP1Tn68/cFj5quj 78l3vg95ml4LDVog68kmGvO82uSoRa0cahBKfR7JLJcVqAhGM+flKmq1OCvQMXnClnzb RhkZ6wJXFK7TW8wCoZa9os1s5n9xslzX4Fjea4VOVpksgOTXeLoqe9xutSN2FTvGH3aV jXSQ== 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:in-reply-to :references:in-reply-to:references; bh=opOg5hr9zGeOQy3sjr/lwSe5+VCb/5vQ408xrxqOqx4=; b=fXX7ABe89CwfRsHBAC48Nb+MwFU264UJZxckXRT8SIqFfzHOMXyRCQAB44MoWn4HmW RC8m89ifTv5AMP08VhDfCPNQ9/kSUWLNtGz76sCTGh9kif9QTDDI7/d1QaeEqV32/58m PKnaVQ0B+QTWy6VXK4mE6f8qjvzOzfocp+3QiPNsy7UkQS2c3VZq9x2/ntlHI8jWmXbO uL5X3JX1JDrFR5ZV4keEQB3ZCoho8MbBd3ULbN24422dTkpSDqC4V6pykB6XALaERzMN f47oBQ262dxIcOuSW1BvpqUL3Daa+ZzS/f6cBebKtIwRP2zijX5HV0CX8S0YiFahhdKs M34w== X-Gm-Message-State: ALKqPwcGIU2ziYOlIfQF93hp28qUj+jnjFQSY1Ly4VeM+SW8VtIYq7Qr CEhGgFelcqMuaRVJpE/6lBWMzQ== X-Google-Smtp-Source: AB8JxZqJk4aamqHZrykqoiXcketgzDEOx0etgo3G4V0TqiEqwJKr1tORH5nvHbPo3gzJB7FCTI17Bg== X-Received: by 2002:a62:6c3:: with SMTP id 186-v6mr2408175pfg.151.1526503139460; Wed, 16 May 2018 13:38:59 -0700 (PDT) Received: from vader.hsd1.wa.comcast.net ([2601:602:8800:a9a9:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id k8-v6sm3858768pga.94.2018.05.16.13.38.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 13:38:58 -0700 (PDT) From: Omar Sandoval To: fstests@vger.kernel.org Cc: "Darrick J . Wong" , Eryu Guan , linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v2 4/5] generic: add test for truncate/fpunch of an active swapfile Date: Wed, 16 May 2018 13:38:48 -0700 Message-Id: <7ac9cec61da44d083476e7d02f57f1a148745431.1526503000.git.osandov@fb.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval These should not be allowed. Signed-off-by: Omar Sandoval --- tests/generic/489 | 73 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/489.out | 8 +++++ tests/generic/group | 1 + 3 files changed, 82 insertions(+) create mode 100755 tests/generic/489 create mode 100644 tests/generic/489.out diff --git a/tests/generic/489 b/tests/generic/489 new file mode 100755 index 00000000..dd40a81d --- /dev/null +++ b/tests/generic/489 @@ -0,0 +1,73 @@ +#! /bin/bash +# FS QA Test 489 +# +# Test truncation/hole punching of an active swapfile. +# +#----------------------------------------------------------------------- +# Copyright (c) 2018 Facebook. 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_swapfile +_require_xfs_io_command "fpunch" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir="$SCRATCH_MNT/test-$seq" +mkdir "$testdir" + +blocks=160 +blksz=65536 + +echo "Initialize file" +_format_swapfile "$testdir/file1" $((blocks * blksz)) +swapon "$testdir/file1" + +echo "Try to truncate" +$XFS_IO_PROG -c "truncate $blksz" "$testdir/file1" + +echo "Try to punch hole" +$XFS_IO_PROG -c "fpunch $blksz $((2 * blksz))" "$testdir/file1" + +echo "Tear it down" +swapoff "$testdir/file1" + +status=0 +exit diff --git a/tests/generic/489.out b/tests/generic/489.out new file mode 100644 index 00000000..e2ebc530 --- /dev/null +++ b/tests/generic/489.out @@ -0,0 +1,8 @@ +QA output created by 489 +Format and mount +Initialize file +Try to truncate +ftruncate: Text file busy +Try to punch hole +fallocate: Text file busy +Tear it down diff --git a/tests/generic/group b/tests/generic/group index 1f504ce1..a5252aeb 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -491,3 +491,4 @@ 486 auto quick attr 487 auto quick 488 auto quick swap +489 auto quick swap