From patchwork Wed May 16 20:38:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10404823 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 DDF82601D2 for ; Wed, 16 May 2018 20:39:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD29126E96 for ; Wed, 16 May 2018 20:39:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1CA428707; Wed, 16 May 2018 20:39:22 +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 69B7B286F8 for ; Wed, 16 May 2018 20:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751290AbeEPUjU (ORCPT ); Wed, 16 May 2018 16:39:20 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:38586 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbeEPUi7 (ORCPT ); Wed, 16 May 2018 16:38:59 -0400 Received: by mail-pg0-f52.google.com with SMTP id n9-v6so786447pgq.5 for ; Wed, 16 May 2018 13:38:59 -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=tDUl1qDFzYRHQUNReBy+aNj8Tvh3segWkQb+PNMwOAY=; b=K6Cl7lMbMtm20YSqbI+PyVQL1bxQecCYWvoiQHF+cwdPkxxhACRLDqwL5sLbfI/NDC +LXKU731PD7dBHdosPVpQ070q+cF8X4AMkaW6xRgSd65ziWPLp2Mq4yEheQ7m/1cRVQY vLLf2JzGmELqX8AGIoe3FaFqMBYTgCacoqT9ZGeWFjZGFzE+xFTzZ/MCBnA8XBrEUzBW l4dEQzEUcUN+XqTGCIPO4A/PMnQrBS2YaIx/Up5I44nXm3vZPK3g1VJ8onXPw+Zo39Vq gVOrMLyD2rZYuo6FrrA7vh2UAsNrvlCCZW6FmNTI+Sz3E+QBawk5B+yxFjgIc/O3kK9O B45w== 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=tDUl1qDFzYRHQUNReBy+aNj8Tvh3segWkQb+PNMwOAY=; b=LRMrEXxNQ5t/kj9kFyO3cV6MCk7OtksfmxoN2CyZIuCX2irJ67WtdFZLE5We7hZFli kk9ljvclgQKNU3nV+lEXcBbrL+L+gbhkGzjXp1m1ABJk6WdcqHgtwg//Zbp55WMBoN7x MnyZWD2UwFco8s3hvVQS2s1uZ7g5L1ZrfJdz59WBt36C3cwccdiPhZDmOodKDUsb5ZWm OpUziDTfEcGvCdNmXlQES/SsJ58kf/Z4N8ABY9aiJYMAN/ulli+uh+hrF2StDV1L9juW P7rKff82tYbufdEeqcDy9/d0b54V9Hp3l2tZ2Lfprk6kiPIqZOpV+3BcKr2PCXcb6dEF 7CRg== X-Gm-Message-State: ALKqPwcKYY3frTeql7UZvg9C/vzXipjn6+f2KXi26u6F+1q4/6V+fiMk N181C1imeBL6eCYGPUbcbmoJs/iRS/4= X-Google-Smtp-Source: AB8JxZo/AkXgnpny3HJzLpK3pzwgFyuzVIZW6GolUO2QbDbNMABXnARq6MoN9gOG4ipWqnNAX5wUaQ== X-Received: by 2002:a62:5281:: with SMTP id g123-v6mr2471777pfb.22.1526503138378; Wed, 16 May 2018 13:38:58 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 13:38:57 -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 3/5] generic: add test for dedupe on an active swapfile Date: Wed, 16 May 2018 13:38:47 -0700 Message-Id: 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 Similar to generic/356 that makes sure we can't reflink an active swapfile. Signed-off-by: Omar Sandoval --- tests/generic/488 | 76 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/488.out | 7 ++++ tests/generic/group | 1 + 3 files changed, 84 insertions(+) create mode 100755 tests/generic/488 create mode 100644 tests/generic/488.out diff --git a/tests/generic/488 b/tests/generic/488 new file mode 100755 index 00000000..39fc887c --- /dev/null +++ b/tests/generic/488 @@ -0,0 +1,76 @@ +#! /bin/bash +# FS QA Test 488 +# +# Check that we can't dedupe a 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 +. ./common/reflink + +rm -f $seqres.full + +_supported_fs generic +_supported_os Linux +_require_scratch_swapfile +_require_scratch_dedupe + +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" + +touch "$testdir/file2" +$CHATTR_PROG +C "$testdir/file2" >/dev/null 2>&1 + +echo "Try to dedupe" +cp "$testdir/file1" "$testdir/file2" +_dedupe_range "$testdir/file1" 0 "$testdir/file2" 0 $((blocks * blksz)) +_dedupe_range "$testdir/file2" 0 "$testdir/file1" 0 $((blocks * blksz)) + +echo "Tear it down" +swapoff "$testdir/file1" + +status=0 +exit diff --git a/tests/generic/488.out b/tests/generic/488.out new file mode 100644 index 00000000..e5a195d1 --- /dev/null +++ b/tests/generic/488.out @@ -0,0 +1,7 @@ +QA output created by 488 +Format and mount +Initialize file +Try to dedupe +XFS_IOC_FILE_EXTENT_SAME: Text file busy +XFS_IOC_FILE_EXTENT_SAME: Text file busy +Tear it down diff --git a/tests/generic/group b/tests/generic/group index cded10f8..1f504ce1 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -490,3 +490,4 @@ 485 auto quick insert 486 auto quick attr 487 auto quick +488 auto quick swap