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: 10404817 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 8788F601C8 for ; Wed, 16 May 2018 20:39:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75E0A26E96 for ; Wed, 16 May 2018 20:39:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A90B28707; Wed, 16 May 2018 20:39:18 +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=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 13317286F8 for ; Wed, 16 May 2018 20:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751395AbeEPUjE (ORCPT ); Wed, 16 May 2018 16:39:04 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:40105 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751315AbeEPUjA (ORCPT ); Wed, 16 May 2018 16:39:00 -0400 Received: by mail-pf0-f194.google.com with SMTP id f189-v6so929700pfa.7 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=bL8u8DtyHqeS2gq+6KIP+cdkb+xzAdbZ1CBGcp2/LwU4Do4R/e94h3yscoKi2sz53P b9lDoYjUHXMg+FFJmwGJABPoYHQxSW+PJWR+pz8gcjJH/hH9D3CyDsdpONjrHERlOg6Q mc4sRv4UNc2VQhSVJcCcPZ2u8VP9mTM7IHzYYGM1Y7Rz6TvGnSdWbZriHHtxIkOgY1Ey QSD/5oFmLYwv5g1hEIj75RJUD+iOsEnpvOmkyiZdIcXQb4e0E9HSGYJIJFXuoIgiBJIm 9r33iLFFevk2ZS/uwDldDIN3MCi6SKw67K3kITlkNyBdMqsbPAi+RQGqt6nlDXUlQvpU C6Vw== X-Gm-Message-State: ALKqPweW/rydvJmlZ6Dem7zguQVmfxlGLcL3xUk8F0NjAZb/Qdh5z4vP JyIEbewxw97dQJBcFODL5A6qk6dL5/Q= 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: 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 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