From patchwork Sun May 26 08:45:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10961415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51BD0112C for ; Sun, 26 May 2019 08:45:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4350F28A57 for ; Sun, 26 May 2019 08:45:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 375B628AA4; Sun, 26 May 2019 08:45:47 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 DC48028A57 for ; Sun, 26 May 2019 08:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727607AbfEZIpq (ORCPT ); Sun, 26 May 2019 04:45:46 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34809 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727570AbfEZIpq (ORCPT ); Sun, 26 May 2019 04:45:46 -0400 Received: by mail-wr1-f68.google.com with SMTP id f8so13862346wrt.1; Sun, 26 May 2019 01:45:44 -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:in-reply-to:references; bh=tckcn1y7FRzPO6G+za+EoFRuwFIstypjqH+5hS8iplw=; b=WlmkaEJpte23u6Dl9zCuzyqbEWvbovqpjI/mZsT2OaHmYeKwdbSFJ6ZElhofx6FE57 pTrAgW0ls0WzinBloO6YEtf4gu8VqBPCugDjYFfmVPuMzs8US+nmv7nw1t7enEimD78P 03UKsl7pJp6bb+BvWSFcjlf8Z28QCoNK7Oa5uv730n4BE/Qp3ZXWQn5P94vdWFfkK05d LqM2wu0uJAUxoNhD46JTDMh6Br7DStWGJjke3Xfjqj5TSs0VoctBSm3DJbR4u2MHW6XY AMVtJPmVwcbc5bZW0dEOJlhWmMiPlt+/xcwOVGvZ8WePMSD0nfNaF+0debhvP0hEpN0x eDgw== 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; bh=tckcn1y7FRzPO6G+za+EoFRuwFIstypjqH+5hS8iplw=; b=s1Vlc908UYWMc9ilaJ4SbjIhLbR35CLYdyzG8D513ioIwsT+ALMNmDYYAyiZnP3xKR EsPhKFoDI2Mz35iIadNxNa6vY47ujZyfU1WuJCbJtCrp14KD9eUpCDp7sUpr0Ga3OY2m qOs8JxMjAaoJNIwKyoXvxgsg56gMGAHLCBPHkc/PNiNuryFNQl+q6tf5hnlDwYw86bhp 4HAndJISpNzTir/glxIvX98yNm4DPgyVZyIiW+5gP19H/1aemDaFNH1wkEmACV6vq8Y6 fGTHya6zCwBmgml5bRhFuEKidNaXZs/IBXWcR2h91UOaC6A0pZnMkhr3c3qHlgioy0yq OKfw== X-Gm-Message-State: APjAAAVc6X3Pop0rsjEx4c2MIrAWRUpcXrEyN01a/LJSAjyJbrlTpQ65 5Ec3R8mqicOPF9RJ3AEcMVQ= X-Google-Smtp-Source: APXvYqw9GFKKMhbAfdF0nCC1+D4AP5s4W/vWJ0y6xJbUrju2jpLcoriYAyMB+N8+IbXCOONpbkvgOQ== X-Received: by 2002:adf:f9c5:: with SMTP id w5mr39523188wrr.26.1558860343834; Sun, 26 May 2019 01:45:43 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id q11sm7089717wmc.15.2019.05.26.01.45.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 01:45:43 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Dave Chinner , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org, Dave Chinner Subject: [PATCH v2 1/5] generic: create copy_range group Date: Sun, 26 May 2019 11:45:31 +0300 Message-Id: <20190526084535.999-2-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190526084535.999-1-amir73il@gmail.com> References: <20190526084535.999-1-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move some tests to the copy_range group so they are distinct from the copy group which refers to xfs_copy tests. [Amir] Revert copy past EOF behavior change Signed-off-by: Dave Chinner Signed-off-by: Amir Goldstein --- tests/generic/434 | 2 ++ tests/generic/group | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/generic/434 b/tests/generic/434 index 032f933d..edbf49d3 100755 --- a/tests/generic/434 +++ b/tests/generic/434 @@ -46,10 +46,12 @@ $XFS_IO_PROG -f -c "copy_range -s 1000 -l 100 $testdir/file" "$testdir/copy" md5sum $testdir/copy | _filter_test_dir echo "Try to copy to a read-only file" +rm -f $testdir/copy $XFS_IO_PROG -r -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" md5sum $testdir/copy | _filter_test_dir echo "Try to copy to an append-only file" +rm -f $testdir/copy $XFS_IO_PROG -a -f -c "copy_range -s 0 -l 100 $testdir/file" "$testdir/copy" md5sum $testdir/copy | _filter_test_dir diff --git a/tests/generic/group b/tests/generic/group index 49639fc9..b498eb56 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -432,11 +432,11 @@ 427 auto quick aio rw 428 auto quick dax 429 auto encrypt -430 auto quick copy -431 auto quick copy -432 auto quick copy -433 auto quick copy -434 auto quick copy +430 auto quick copy_range +431 auto quick copy_range +432 auto quick copy_range +433 auto quick copy_range +434 auto quick copy_range 435 auto encrypt 436 auto quick rw seek prealloc 437 auto quick dax From patchwork Sun May 26 08:45:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10961417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF06E91E for ; Sun, 26 May 2019 08:45:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE92828A57 for ; Sun, 26 May 2019 08:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2AD528AA5; Sun, 26 May 2019 08:45:48 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 7A6C028A57 for ; Sun, 26 May 2019 08:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727621AbfEZIpr (ORCPT ); Sun, 26 May 2019 04:45:47 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36544 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727546AbfEZIpq (ORCPT ); Sun, 26 May 2019 04:45:46 -0400 Received: by mail-wr1-f66.google.com with SMTP id s17so13861458wru.3; Sun, 26 May 2019 01:45:45 -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:in-reply-to:references; bh=YvfcaysMqm5sUoN6yrpm+q3A2ssaIwvLl370KrpnxxA=; b=T0M5GXcsvuU3HfQD/Pjpk9NuvYovh9/LvCcZ9knf4LFg4BAVJpFo8rdQH0fSXR/aiK DK4Fn7IWb520UT/Qo0W+/AOV0A1bqjMNcc82onzyf7kzPDv1kO6kXebhkPzQSc+xrqP/ XNonZwJgOU18yCqLKAn6srGQCyY9lnd5F9X5N9jjuWRa+KbrKzbujuU5hxdLD6/kj1cG oNNqQNVJ0oJ3I1Rep3ATep5NTLXu7yfNcRpFOExUnxclhGgnAafo94aTPsonofvCZBg5 sQlozAJQMmYePNTdpnJoQ7VGNRmhTKE4KMnP0CsqbPY8ZlsKoEi15MIJJYgMLERmbYeG C5hA== 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; bh=YvfcaysMqm5sUoN6yrpm+q3A2ssaIwvLl370KrpnxxA=; b=VA5FOpT414YAMEuhQLO8nMd7PpMYRRWDPIlA2OvyBcnIg2Nsp58XERvcWgpSCWyIDP mH+rb1tXpOmXRoWErvGES/sIRNCajwJJYv8ziwk6gx/s4kGebZwwb/h2Bbp8K9F2auVm r+ZffZb3GpKHeQjdheyyllrzHI3HTDyIYg8r85BTt+4xKCELwjQhcrTr7X/sZqEBbVJi 0CWbg2eMKmsfvXdv7OiPwJ8Dr06b6iF/7PL3Q5Oh1GqvQTDA+09VJLqniV0lhdDRotam PcroMkkzkyZZ6ZtQhwDmEdIYHP2DaD0/IwOXR5HWj4S6cktgsVaqe6VLSbEQ9fTSJJEX /1eQ== X-Gm-Message-State: APjAAAVqemYNoyOPXBs4xsa9anAJE3XpHW3IL+oopSCtuzFYIEWSMpNF YLKV6SxWgaCb1tMvFPBo1GQ= X-Google-Smtp-Source: APXvYqz0GRIIbwi0QQkeqQSPvpkNDyMT7XxzeFtYpEPBGp3H9qSDmC1FQlAenFAmsryamUnbqHyldQ== X-Received: by 2002:adf:b643:: with SMTP id i3mr23738246wre.284.1558860345090; Sun, 26 May 2019 01:45:45 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id q11sm7089717wmc.15.2019.05.26.01.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 01:45:44 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Dave Chinner , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v2 2/5] generic: copy_file_range immutable file test Date: Sun, 26 May 2019 11:45:32 +0300 Message-Id: <20190526084535.999-3-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190526084535.999-1-amir73il@gmail.com> References: <20190526084535.999-1-amir73il@gmail.com> 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 was split out of Dave Chinner's copy_file_range bounds check test to reduce the requirements for running the bounds check. Signed-off-by: Amir Goldstein --- tests/generic/988 | 59 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/988.out | 5 ++++ tests/generic/group | 1 + 3 files changed, 65 insertions(+) create mode 100755 tests/generic/988 create mode 100644 tests/generic/988.out diff --git a/tests/generic/988 b/tests/generic/988 new file mode 100755 index 00000000..0f4ee4ea --- /dev/null +++ b/tests/generic/988 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 988 +# +# Check that we cannot copy_file_range() to/from an immutable file +# +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 7 15 + +_cleanup() +{ + $CHATTR_PROG -i $testdir/immutable > /dev/null 2>&1 + cd / + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs generic + +rm -f $seqres.full + +_require_test +_require_chattr i +_require_xfs_io_command "copy_range" +_require_xfs_io_command "chattr" + +testdir="$TEST_DIR/test-$seq" +rm -rf $testdir +mkdir $testdir + +rm -f $seqres.full + +$XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1 + +# we have to open the file to be immutable rw and hold it open over the +# chattr command to set it immutable, otherwise we won't be able to open it for +# writing after it's been made immutable. (i.e. would exercise file mode checks, +# not immutable inode flag checks). +echo immutable file returns EPERM +$XFS_IO_PROG -f -c "pwrite -S 0x61 0 64k" -c fsync $testdir/immutable | _filter_xfs_io +$XFS_IO_PROG -f -c "chattr +i" -c "copy_range -l 32k $testdir/file" $testdir/immutable +$XFS_IO_PROG -f -r -c "chattr -i" $testdir/immutable + +# success, all done +status=0 +exit diff --git a/tests/generic/988.out b/tests/generic/988.out new file mode 100644 index 00000000..e74a96bf --- /dev/null +++ b/tests/generic/988.out @@ -0,0 +1,5 @@ +QA output created by 988 +immutable file returns EPERM +wrote 65536/65536 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +copy_range: Operation not permitted diff --git a/tests/generic/group b/tests/generic/group index b498eb56..20b95c14 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -550,3 +550,4 @@ 545 auto quick cap 546 auto quick clone enospc log 547 auto quick log +988 auto quick copy_range From patchwork Sun May 26 08:45:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10961421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABA1716C1 for ; Sun, 26 May 2019 08:45:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CFA628A57 for ; Sun, 26 May 2019 08:45:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9193B28AA4; Sun, 26 May 2019 08:45:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3504A28A57 for ; Sun, 26 May 2019 08:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727633AbfEZIps (ORCPT ); Sun, 26 May 2019 04:45:48 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44092 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727570AbfEZIps (ORCPT ); Sun, 26 May 2019 04:45:48 -0400 Received: by mail-wr1-f65.google.com with SMTP id w13so5476924wru.11; Sun, 26 May 2019 01:45:46 -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:in-reply-to:references; bh=tHETMryGVwSaOgR/Yx7oTEa1ui+4bN17f008odA0yXI=; b=QEOxZ33OOFRHrOrc3+DmWTWa6pWMgSjYVeeYJj9nxGy9+xFrF5h0nclJcTdiK0CGWV cAc/f9XA2mwpXJKxvPwF3zQ2DYSVkyu5r7dyQd5+aBMJE8dA4YEzY1s7bQ8BGea1O4lZ l0JYC3SmskhaiMwRHmOMvUMDcU/E7wnG6SInKtO6qcDyqrZ2w2B06fil/zLsG5gfX9uP B+73+SDKLLTtCFPgwsgb1I6B5hTm1Cp/y9MNQd3yE7/Nk42EtHp9gpYP6a9gCneX7p1N +Jlcu3lw7lWhcdwYEtX5ykZBsHROeliNQak/uhErVcBszbQ/YoFS4vTRDhIU9M1IorJ5 mxlQ== 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; bh=tHETMryGVwSaOgR/Yx7oTEa1ui+4bN17f008odA0yXI=; b=Ge61kUqJ+rbsQtnHTPJJK8KqUSiOsYtZMr3raLt6wn+WmY9/eH9lIZZiK8t+fiQUCb rQf5f50g07w5ZirGE1MJvg8dkbEGu/8AdSon7ZEMQwQ7hj4CCia2Fzn4+R5YonQ9X7mc 5C8vHE87ItLQd21Q/jH6eKak6lv3BR0k130akwSDIcfGxF/uElEW9hdjyhUajl1jH4JX Whq22zf1XhrrIdG9mxxS2lqz069juILqGPgdHphY07bCheWl/XWQIqF8N7klPq5g3ko6 9ay23PfBizWtNbbjY5l8CatCa0u262VtlU6igAiGWT1Jd5qm4hx9FHQWxBdnnXexhxtH +XoA== X-Gm-Message-State: APjAAAU3xtmi4XpFDpPnmnGFcflvQ22ss4ODtsPsN6qc0mgnKzcSFikS 8tSKVZl0GEIV4uR6bK8+ysk= X-Google-Smtp-Source: APXvYqy21bIG21eVFJtCGEF6Zhn/cDGqqbuiX/DJs1FWRlS+jHK1wUv9wOIvWm3LLybFCSvDt7rOjA== X-Received: by 2002:adf:f00d:: with SMTP id j13mr3229483wro.178.1558860346353; Sun, 26 May 2019 01:45:46 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id q11sm7089717wmc.15.2019.05.26.01.45.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 01:45:45 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Dave Chinner , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v2 3/5] generic: copy_file_range swapfile test Date: Sun, 26 May 2019 11:45:33 +0300 Message-Id: <20190526084535.999-4-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190526084535.999-1-amir73il@gmail.com> References: <20190526084535.999-1-amir73il@gmail.com> 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 was split out of Dave Chinner's copy_file_range bounds check test to reduce the requirements for running the bounds check. Signed-off-by: Amir Goldstein --- tests/generic/989 | 56 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/989.out | 4 ++++ tests/generic/group | 1 + 3 files changed, 61 insertions(+) create mode 100755 tests/generic/989 create mode 100644 tests/generic/989.out diff --git a/tests/generic/989 b/tests/generic/989 new file mode 100755 index 00000000..27c10296 --- /dev/null +++ b/tests/generic/989 @@ -0,0 +1,56 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 989 +# +# Check that we cannot copy_file_range() to/from a swapfile +# +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 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs generic + +rm -f $seqres.full + +_require_scratch +_require_xfs_io_command "copy_range" +_require_scratch_swapfile + +_scratch_mkfs 2>&1 >> $seqres.full +_scratch_mount + +testdir=$SCRATCH_MNT + +rm -f $seqres.full + +$XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1 + +echo swap files return ETXTBUSY +_format_swapfile $testdir/swapfile 16m +swapon $testdir/swapfile +$XFS_IO_PROG -f -c "copy_range -l 32k $testdir/file" $testdir/swapfile +$XFS_IO_PROG -f -c "copy_range -l 32k $testdir/swapfile" $testdir/copy +swapoff $testdir/swapfile + +# success, all done +status=0 +exit diff --git a/tests/generic/989.out b/tests/generic/989.out new file mode 100644 index 00000000..32da0ce9 --- /dev/null +++ b/tests/generic/989.out @@ -0,0 +1,4 @@ +QA output created by 989 +swap files return ETXTBUSY +copy_range: Text file busy +copy_range: Text file busy diff --git a/tests/generic/group b/tests/generic/group index 20b95c14..4c100781 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -551,3 +551,4 @@ 546 auto quick clone enospc log 547 auto quick log 988 auto quick copy_range +989 auto quick copy_range swap From patchwork Sun May 26 08:45:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10961425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 763A1112C for ; Sun, 26 May 2019 08:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 677F728A9B for ; Sun, 26 May 2019 08:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BD9128AA7; Sun, 26 May 2019 08:45:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A649C28A57 for ; Sun, 26 May 2019 08:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727637AbfEZIpu (ORCPT ); Sun, 26 May 2019 04:45:50 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33071 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727546AbfEZIpt (ORCPT ); Sun, 26 May 2019 04:45:49 -0400 Received: by mail-wr1-f67.google.com with SMTP id d9so13855498wrx.0; Sun, 26 May 2019 01:45:48 -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:in-reply-to:references; bh=MqkblXOxVV9ASw3P2jXOp/Vdq1sqhgvgEl0BfGnSzus=; b=vNl8P5QsEvVHyTGavSu+EeAg67Uq4qsIJY7FVdzXEA/K2ApUr168PNqyNgGVSKfLwu ppndZCiurKpazssaAVfP+RgpauSJiRA2eXrZ2MvzA2V0cjFuAOs6A2BZ2I4nze5p2466 QTh0WwCslELKqTvScUicacxip9Cl/R/xXEkjPlcHPLTupEta9gXeZ2S25bh4+HZq+dA2 WMvye/o2MFv6FsQ6xgPRU99R61RMNcRttRCLlLAgN8r6+WZEfr32TxwY1a/+qL/FCvWw OJp4WAWGNplvH7YvMOaF13cWlJ/Cu8wRMf3R1fkGlGfwShrCBz+abA8z7niR3JNjNUFj 9ULw== 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; bh=MqkblXOxVV9ASw3P2jXOp/Vdq1sqhgvgEl0BfGnSzus=; b=crOwGBRKp4OeUvZf0Cn+OPp46OTpcS6lKKgmZfje1JpjwQN+lyHKSFQzQSq9hDdEHu BHXkvNcka9MwNRI8GyZBVeAQhMOhramKHWnpWygIy59B1OSQBsuRypSIUukcuiRmXCJe UjT5z80sZwi3m75WMHtag3ReHtEPa914h4WTHoX45IvCevcjoNhRRbk8tTx4hIVYu8Al cOPcDottEzsq3cSGKxbfmA4X2djYCuNx4drrJmgg+E6yiWYoVV6fMNkSU2qtaztKF6qb I+P4BpqQoggcLf0zAV0htNdRDY4H6edhqzwcmp6R7lI/rlXdmsxZjf0R7e6bgWaVLeN6 Yy4A== X-Gm-Message-State: APjAAAULHN8sDJWyT/IrzZNED/EeqPo0+7Qv/885YA6mwY2qcLHVwX+P 9Wq5HOPO4W/C10RQ514+n4w= X-Google-Smtp-Source: APXvYqzMQYiOsBWKs5vsfboziHLSdehUvg70O0ugPeru/xCN2wzH+KTgeOqOC+19WH4mMvPqJZxQiA== X-Received: by 2002:adf:e3cd:: with SMTP id k13mr2655347wrm.200.1558860347709; Sun, 26 May 2019 01:45:47 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id q11sm7089717wmc.15.2019.05.26.01.45.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 01:45:47 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Dave Chinner , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org, Dave Chinner Subject: [PATCH v2 4/5] generic: copy_file_range bounds test Date: Sun, 26 May 2019 11:45:34 +0300 Message-Id: <20190526084535.999-5-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190526084535.999-1-amir73il@gmail.com> References: <20190526084535.999-1-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Test that copy_file_range will return the correct errors for various error conditions and boundary constraints. [Amir] Split out cross-device copy_range test and use only scratch dev. Split out immutable/swapfile test cases to reduce the requirements to run the bounds check to minimum and get coverage for more filesystems. Remove the tests for read past EOF and write after chmod -r, because we decided to stick with read(2)/write(2) semantics. Signed-off-by: Dave Chinner Signed-off-by: Amir Goldstein --- tests/generic/990 | 123 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/990.out | 37 +++++++++++++ tests/generic/group | 1 + 3 files changed, 161 insertions(+) create mode 100755 tests/generic/990 create mode 100644 tests/generic/990.out diff --git a/tests/generic/990 b/tests/generic/990 new file mode 100755 index 00000000..5e2421b6 --- /dev/null +++ b/tests/generic/990 @@ -0,0 +1,123 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 990 +# +# Exercise copy_file_range() syscall error conditions. +# +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 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs generic + +rm -f $seqres.full + +_require_test +_require_xfs_io_command "copy_range" +# +# This test effectively requires xfs_io v4.20 with the commits +# 2a42470b xfs_io: copy_file_range length is a size_t +# 1a05efba io: open pipes in non-blocking mode +# +# The same xfs_io release also included the new 'chmod' command. +# Use this fake requirement to prevent the test case of copy_range with fifo +# from hanging the test with old xfs_io. +# +_require_xfs_io_command "chmod" + +testdir="$TEST_DIR/test-$seq" +rm -rf $testdir +mkdir $testdir + +rm -f $seqres.full + +$XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1 + +echo source range overlaps destination range in same file returns EINVAL +$XFS_IO_PROG -f -c "copy_range -s 32k -d 48k -l 32k $testdir/file" $testdir/file + +echo +echo destination file O_RDONLY returns EBADF +$XFS_IO_PROG -f -r -c "copy_range -l 32k $testdir/file" $testdir/copy + +echo +echo destination file O_APPEND returns EBADF +$XFS_IO_PROG -f -a -c "copy_range -l 32k $testdir/file" $testdir/copy + +echo +echo source/destination as directory returns EISDIR +$XFS_IO_PROG -c "copy_range -l 32k $testdir/file" $testdir +$XFS_IO_PROG -f -c "copy_range -l 32k $testdir" $testdir/copy + +echo +echo source/destination as blkdev returns EINVAL +mknod $testdir/dev1 b 1 3 +$XFS_IO_PROG -c "copy_range -l 32k $testdir/file" $testdir/dev1 +$XFS_IO_PROG -f -c "copy_range -l 32k $testdir/dev1" $testdir/copy + +echo +echo source/destination as chardev returns EINVAL +mknod $testdir/dev2 c 1 3 +$XFS_IO_PROG -c "copy_range -l 32k $testdir/file" $testdir/dev2 +$XFS_IO_PROG -f -c "copy_range -l 32k $testdir/dev2" $testdir/copy + +echo +echo source/destination as FIFO returns EINVAL +mkfifo $testdir/fifo +$XFS_IO_PROG -c "copy_range -l 32k $testdir/file" $testdir/fifo +$XFS_IO_PROG -f -c "copy_range -l 32k $testdir/fifo" $testdir/copy + +max_off=$((8 * 2**60 - 65536 - 1)) +min_off=65537 + +echo +echo length beyond 8EiB wraps around 0 returns EOVERFLOW +$XFS_IO_PROG -f -c "copy_range -l 10e -s $max_off $testdir/file" $testdir/copy +$XFS_IO_PROG -f -c "copy_range -l 10e -d $max_off $testdir/file" $testdir/copy + +echo +echo source range beyond 8TiB returns 0 +$XFS_IO_PROG -c "copy_range -s $max_off -l $min_off -d 0 $testdir/file" $testdir/copy + +echo +echo destination range beyond 8TiB returns EFBIG +$XFS_IO_PROG -c "copy_range -l $min_off -s 0 -d $max_off $testdir/file" $testdir/copy + +echo +echo destination larger than rlimit returns EFBIG +rm -f $testdir/copy +$XFS_IO_PROG -c "truncate 128k" $testdir/file + +# need a wrapper so the "File size limit exceeded" error can be filtered +do_rlimit_copy() +{ + $XFS_IO_PROG -f -c "copy_range -l 32k -s 0 -d 16m $testdir/file" $testdir/copy +} + +ulimit -f $((8 * 1024)) +ulimit -c 0 +do_rlimit_copy 2>&1 | grep -o "File size limit exceeded" +ulimit -f unlimited + +# success, all done +status=0 +exit diff --git a/tests/generic/990.out b/tests/generic/990.out new file mode 100644 index 00000000..05d137de --- /dev/null +++ b/tests/generic/990.out @@ -0,0 +1,37 @@ +QA output created by 990 +source range overlaps destination range in same file returns EINVAL +copy_range: Invalid argument + +destination file O_RDONLY returns EBADF +copy_range: Bad file descriptor + +destination file O_APPEND returns EBADF +copy_range: Bad file descriptor + +source/destination as directory returns EISDIR +copy_range: Is a directory +copy_range: Is a directory + +source/destination as blkdev returns EINVAL +copy_range: Invalid argument +copy_range: Invalid argument + +source/destination as chardev returns EINVAL +copy_range: Invalid argument +copy_range: Invalid argument + +source/destination as FIFO returns EINVAL +copy_range: Invalid argument +copy_range: Invalid argument + +length beyond 8EiB wraps around 0 returns EOVERFLOW +copy_range: Value too large for defined data type +copy_range: Value too large for defined data type + +source range beyond 8TiB returns 0 + +destination range beyond 8TiB returns EFBIG +copy_range: File too large + +destination larger than rlimit returns EFBIG +File size limit exceeded diff --git a/tests/generic/group b/tests/generic/group index 4c100781..86802d54 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -552,3 +552,4 @@ 547 auto quick log 988 auto quick copy_range 989 auto quick copy_range swap +990 auto quick copy_range From patchwork Sun May 26 08:45:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10961427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8EC016C1 for ; Sun, 26 May 2019 08:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA1B928A57 for ; Sun, 26 May 2019 08:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE63328AAA; Sun, 26 May 2019 08:45:51 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 6039728A57 for ; Sun, 26 May 2019 08:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727546AbfEZIpu (ORCPT ); Sun, 26 May 2019 04:45:50 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37203 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727570AbfEZIpu (ORCPT ); Sun, 26 May 2019 04:45:50 -0400 Received: by mail-wr1-f67.google.com with SMTP id e15so13852309wrs.4; Sun, 26 May 2019 01:45:49 -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:in-reply-to:references; bh=KAqTSWaCfZ2eRPTYfukH/E0JoydIlA6rQXV7TtACnYY=; b=Wq3BOf/joym/GwGVtB6iR/Y5aWF4YRCmMLjSfRdEPL4a0YGl9MORdY0kQ0MkHVy/EN yd4SwBNFzv2+XALN+WEVy7MDC0TIibbkofu1mlY4+E/PR9RffxKi8QZs1fbTArIkxKhz oubNF0Rav6+ICvESaOC28IFb8oj4ocNQiCf8mnVNrmj7ZC+MNUjpuDKxnzr/Oqm3s2as CiUiqSilArE5Iip3VmxNN27LjYDjLsyC0+5ja2+kPBd8jLpa76QyZXu3SbyHJ6r+yMh0 BYt122vZTHDZwQ3xg2jDFFkr2vXecTdYL8nBwLkWqF+/qFRrKd0LCk4LjJvmMBF4fT1S azjw== 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; bh=KAqTSWaCfZ2eRPTYfukH/E0JoydIlA6rQXV7TtACnYY=; b=PhsKmTdmoRb/Zu/QoTlHrO9wvUOlOrAKGwBOnqC7NQOJ2WMsJP2RaBxOxjSRae1mXl TedR866pBr24r+HCvJ4Pa+5K08CZ/OOcxMpe3TvKOdBBxLpEXirDnhhD6XkAVa6XDbAo bVEjPDIfGgWaKncyL1dB4own8Vq5zZ2D8CYu4NnGiBEKwfeAwBMJ72BvoMFt51VSfkty PX3ADmSoIr5aO508CTFsnWdUMSNoZe8pSu8+t4du1vioY6p3kbfNUeg4vRA+tN7BCegB GYDyvU6I1A/iQjZQrPMnLxwurc8O4XWG6inccgAhQ/giCvjswXr0lyeiw9rRg5MUNirW PvqA== X-Gm-Message-State: APjAAAUhqcdXKsFXdNCWo6BA+63mDByOVVXr486Yc3gSaCIsZsT/xeMW YJojZ23PMeh+5Su2md4jLHg= X-Google-Smtp-Source: APXvYqwi3ooBt8E8X6grWk/xnqmGLIx9P0ANZCcG2R52nq7uU6R9IjfX2D87daGE/ojirOe2jva0vA== X-Received: by 2002:a05:6000:1284:: with SMTP id f4mr58969334wrx.325.1558860348963; Sun, 26 May 2019 01:45:48 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id q11sm7089717wmc.15.2019.05.26.01.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 01:45:48 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Dave Chinner , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org, Dave Chinner Subject: [PATCH v2 5/5] generic: cross-device copy_file_range test Date: Sun, 26 May 2019 11:45:35 +0300 Message-Id: <20190526084535.999-6-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190526084535.999-1-amir73il@gmail.com> References: <20190526084535.999-1-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Old kernels do not support cross-device copy_file_range. A new patch set is aimed at allowing cross-device copy_file_range using the default in-kernel copy implementation. [Amir] Split out cross-device copy_range test to a new test. Signed-off-by: Dave Chinner Signed-off-by: Amir Goldstein --- tests/generic/991 | 56 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/991.out | 4 ++++ tests/generic/group | 1 + 3 files changed, 61 insertions(+) create mode 100755 tests/generic/991 create mode 100644 tests/generic/991.out diff --git a/tests/generic/991 b/tests/generic/991 new file mode 100755 index 00000000..94266e89 --- /dev/null +++ b/tests/generic/991 @@ -0,0 +1,56 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 991 +# +# Exercise copy_file_range() across devices +# +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 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_os Linux +_supported_fs generic + +rm -f $seqres.full + +_require_test +_require_scratch +_require_xfs_io_command "copy_range" + +_scratch_mkfs 2>&1 >> $seqres.full +_scratch_mount + + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +$XFS_IO_PROG -f -c "pwrite -S 0x61 0 128k" $testdir/file >> $seqres.full 2>&1 + +$XFS_IO_PROG -f -c "copy_range -l 128k $testdir/file" $SCRATCH_MNT/copy +cmp $testdir/file $SCRATCH_MNT/copy +echo "md5sums after xdev copy:" +md5sum $testdir/file $SCRATCH_MNT/copy | _filter_test_dir | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/991.out b/tests/generic/991.out new file mode 100644 index 00000000..19c22dfe --- /dev/null +++ b/tests/generic/991.out @@ -0,0 +1,4 @@ +QA output created by 991 +md5sums after xdev copy: +81615449a98aaaad8dc179b3bec87f38 TEST_DIR/test-991/file +81615449a98aaaad8dc179b3bec87f38 SCRATCH_MNT/copy diff --git a/tests/generic/group b/tests/generic/group index 86802d54..bc5dac3b 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -553,3 +553,4 @@ 988 auto quick copy_range 989 auto quick copy_range swap 990 auto quick copy_range +991 auto quick copy_range