From patchwork Sun Jun 2 12:41:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10971743 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 2870918A6 for ; Sun, 2 Jun 2019 12:41:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1490728BA0 for ; Sun, 2 Jun 2019 12:41:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07FEB28BBC; Sun, 2 Jun 2019 12:41:26 +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 A329128BA0 for ; Sun, 2 Jun 2019 12:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbfFBMlZ (ORCPT ); Sun, 2 Jun 2019 08:41:25 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37776 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfFBMlZ (ORCPT ); Sun, 2 Jun 2019 08:41:25 -0400 Received: by mail-wm1-f68.google.com with SMTP id 22so390841wmg.2; Sun, 02 Jun 2019 05:41:23 -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=aH6OlV7e7Q1VqQuuAmbgzOJrikOWu4pnksLXOJabPp5bRyzTFu+btfC7E+NVNDd2At majA3ms5igQBJi9jaK9gGrfjvS6oHRb2c0GCufrfxQRvOrOBaHofFGRDA8KInICqRCSW 04+Oz6rlYFcqrymJOwmPhQ+iAKsfC0gy55d/JyU4Z+rRCOQm8sggkJK7ZbI1dQGWslk7 QVn7RBrzp1E2rHezD0kKn1GsttLo2uKgmwsPyV0GogVfeLYUQXeeDxNdtwhgFzS87P+I zJbKnKXEnRR5TWwXTVALdIjL3q3npZ/u93M4Uuxmm5gcU+koZatcdJ3YStMlFBM1ucnd ziUg== 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=QA9ZoliI5yykMf95A3OTz2WeAF0ZcWXeANLonY/5qqiBeh66NCZ6pwxWxrFtxNyZKs 09Iv8HDxHKZPflGY9oaiMtLF+lqiTh4ywDBMPej2U7xH7fxjmGhpLs4yzeirsjXwXjRV 54o90+BUhozwbn0YnuWH2eaSQzUoIUqz4oajV4D2ihQ1YbgXWKO9+nOdvtwscXHtLlZr CX52Z9f37tPgSQ/NPRY8BZ0pKWebVnXqvJ/F42AuFR2tIgIHXoI8fih0O7oxiQxM4zZK 40eAHdmOSEGeKO1SVhE8QgrXtcD0E3obeElNjugLtV8j1oeoxNG7okqTAd/ot8CsThvw JbUw== X-Gm-Message-State: APjAAAXy3gOKebH0Gc5IiQ24duxicE+CcIHDTSWnYIEBl0PBEieNRhGY aBV1OI7ykH7e6htwVtWivNc= X-Google-Smtp-Source: APXvYqwIyaFv2YsfAAg88pMgSkeWJxEDY0BV5PfqcIjJ0bB3S6dazG1L8OV8PIHBUAorPOT4dbR8bg== X-Received: by 2002:a1c:9a16:: with SMTP id c22mr11562318wme.39.1559479282857; Sun, 02 Jun 2019 05:41:22 -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 g185sm11214827wmf.30.2019.06.02.05.41.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 05:41:22 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: "Darrick J . Wong" , Dave Chinner , Olga Kornievskaia , fstests@vger.kernel.org, linux-xfs@vger.kernel.org, Dave Chinner Subject: [PATCH v3 1/6] generic: create copy_range group Date: Sun, 2 Jun 2019 15:41:09 +0300 Message-Id: <20190602124114.26810-2-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602124114.26810-1-amir73il@gmail.com> References: <20190602124114.26810-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 Jun 2 12:41:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10971747 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 53C75912 for ; Sun, 2 Jun 2019 12:41:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43A3328BA0 for ; Sun, 2 Jun 2019 12:41:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37EBE28BBC; Sun, 2 Jun 2019 12:41:28 +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 C64EA28BA0 for ; Sun, 2 Jun 2019 12:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726360AbfFBMl1 (ORCPT ); Sun, 2 Jun 2019 08:41:27 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40884 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfFBMl1 (ORCPT ); Sun, 2 Jun 2019 08:41:27 -0400 Received: by mail-wm1-f66.google.com with SMTP id u16so3380966wmc.5; Sun, 02 Jun 2019 05:41:24 -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=gmLN8a5wDYlbNnehooC3TjyfEIEm23Ahlg66msFPdV2p0W9szeK0bHqQ5jJmqTdxPi 6xMru9nCidIr+OoJ0I/+9oTDeO7OvfI0m2o8fedxCKtGUOjjkrRj12rnR1VzOAuOcsj8 /BMkFSO21bvwgWaXdrW3vhqzA2d8ERpcXc0lc9Tm6/PBWPSItogV8VYH9TILBt2NlPyn UPZnNukgdi3mMk22pP20LAsy0DQufImcg7qFvwBV0xVv/5RLUNZyqVtwSENtXVnUK2nK 1xVSs4FsmqL3nEwMkClifxXlyygCLgDmiWriVsmthDeNpLNALpiyLwSfCzLuctnG2GHs Qdbw== 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=quoJuNrhHPwT0yL80JpSKLyJt2q/FUQphGTmcUogphDO14BDCcL5C7v/qpCnOSzsqb ikUzXWI0C36BTaIHH2Xv8M4prSRKlHVKYox8idyBCSK/8kfyNLBCwLLbRniKpKUiA8ua z4wQXf0wro3Zy0QFp869eUhwDxyKLMYXIzYgUO+oZz2dZqVv6Zd9SKo5DGNfT6nDG5VM J/4j/w3WIqrONbmExntpeWsZHxpxn2Fj8v8SqepT3hw6i+51a0ftyah7xyULzM6ZujfF //49HojEo2qLlxk7nrprMCi0FU9UIaX2vzzHK4nMM/IW9RtJC+W5RTYg4OVf76JynByj YXfA== X-Gm-Message-State: APjAAAUDAHdcZjDzua7EHafHPdAYAoAsiATaw/EkKZEGcMYMjrHl8A+L FsIar5LhPzkSVBziU98cF5o= X-Google-Smtp-Source: APXvYqw7J5qZG6dl3M/TaeaootiuJWUgGpHgpwykQdUyQlrxyXZKxn52XQnXSjqroLUUKIhiaUrmbQ== X-Received: by 2002:a1c:480a:: with SMTP id v10mr11202031wma.120.1559479284244; Sun, 02 Jun 2019 05:41:24 -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 g185sm11214827wmf.30.2019.06.02.05.41.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 05:41:23 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: "Darrick J . Wong" , Dave Chinner , Olga Kornievskaia , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v3 2/6] generic: copy_file_range immutable file test Date: Sun, 2 Jun 2019 15:41:10 +0300 Message-Id: <20190602124114.26810-3-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602124114.26810-1-amir73il@gmail.com> References: <20190602124114.26810-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 Jun 2 12:41:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10971753 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 8999F15E6 for ; Sun, 2 Jun 2019 12:41:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A2B228BA0 for ; Sun, 2 Jun 2019 12:41:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A14A28BA5; Sun, 2 Jun 2019 12:41:29 +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=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 15F5828BA5 for ; Sun, 2 Jun 2019 12:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726416AbfFBMl2 (ORCPT ); Sun, 2 Jun 2019 08:41:28 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54906 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfFBMl2 (ORCPT ); Sun, 2 Jun 2019 08:41:28 -0400 Received: by mail-wm1-f67.google.com with SMTP id g135so5563460wme.4; Sun, 02 Jun 2019 05:41:26 -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=iBDyQp+vCMkD1IDTu/UzXp7v4MtbunVlvFVsLEL39rm9C/JMMI5ZFVQsDF6cl7eoPM lTxZNTNFHR/YGg2gnq94QUKvVYocO+gt12Ar3R22rSZmTXOIvpjHSsmRig5jobkGdRAv Aok3SXNXmEZBKXGXwk3nmd1nL+YIx+tSy1CAtXn+pdayWs4GCAF4dAMR8SGxFRfOAzSd nChWInisP05UVuxObJyUCLE/oGtHYocG5mjrCJUhK93BAqZCH0Jb6GsIJp3y9exibj6h lCpvswp47qbKREHSnJ6LPdcgVRHDVGoOxuJ4ghIu/t+/DitMfcxEPfp0Y4WRI7t7TyF6 CK7g== 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=aZHK/Zh3ov46A/FdQxFtM65lMJrRuQG/MN6HFsfYkKolFuL0kbpVHUk9CiMGfanbKS X+b9cPfpBddG85eAcU4s2dp+FZ21tCbqdYC76YjwqQoK7sDptUUxIwEumnlN1gBHGlgz wVhgWE1ilOc71oHIonorFFbQkA76kseH4vvpBkNx91zcw2bJiVFmBGOuOMk1hnOS2WC0 vN4gJI7w3s1r6KbXJO+G51q+QnXg9Dc7SKCR29X8lS+lR65YA/koYXevAXGNzFCLUpsl 1s0p/shZwCmHXSmg16B7YrB1M8qwj8RkblbPPqPe6kZHJgss8ybC1Uo1cu8qgXaurso5 q1vA== X-Gm-Message-State: APjAAAWBA0twF/odGnFm67Eq5qDnxp90gIKPSMSNeP803XIOzcz5Y7ux Cw2FhzkRy7yhezg8BkSY48Vt5qsK X-Google-Smtp-Source: APXvYqyuBU7fGb6Ot08Hk7RHDIPOo0ZmbAylFLvhLyFSkNT7WP3DuMbQEfAan07u1QmA0EtRgEzpdw== X-Received: by 2002:a1c:2358:: with SMTP id j85mr11365061wmj.46.1559479285649; Sun, 02 Jun 2019 05:41:25 -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 g185sm11214827wmf.30.2019.06.02.05.41.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 05:41:25 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: "Darrick J . Wong" , Dave Chinner , Olga Kornievskaia , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v3 3/6] generic: copy_file_range swapfile test Date: Sun, 2 Jun 2019 15:41:11 +0300 Message-Id: <20190602124114.26810-4-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602124114.26810-1-amir73il@gmail.com> References: <20190602124114.26810-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 Jun 2 12:41:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10971755 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 ADF5F912 for ; Sun, 2 Jun 2019 12:41:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E76728BA0 for ; Sun, 2 Jun 2019 12:41:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92E2628BA5; Sun, 2 Jun 2019 12:41:29 +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 474A928BBC for ; Sun, 2 Jun 2019 12:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726465AbfFBMl3 (ORCPT ); Sun, 2 Jun 2019 08:41:29 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34737 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfFBMl2 (ORCPT ); Sun, 2 Jun 2019 08:41:28 -0400 Received: by mail-wr1-f66.google.com with SMTP id e16so1206985wrn.1; Sun, 02 Jun 2019 05:41:27 -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=YeE+/BVUjXzXtoRPrMlnZ7zrvZqFsthbg+ijCE7TqkE=; b=gjnt2+49FgfzLTbXMPdMhQADlZ4URIceNw3GlTodGW0Ck/fPXWEwHRxhmbDr1+WjKN 6pL+Jfw4vUr8Sv1avpgGiTScmYWyi/0/ZCBoYdipFz/5jNeArWRe7aXju+yOaBp+8fbk t/P5ivx7M8/qthFM9/N6zvmSgkGBCr8vFKXrOOm3JVQbrAmbPt3DkBEc8p0s0g2ZdVMs dXFb2GeyhxyuHRT58waWAkWvbJdOVGWCQZJcFExT+mMlnzKZ1oGEXv44tQYUHL5H7qVe 4PkpjB8/YiYKEUC7i5EL9Kv5tQNs0DD+Ji0JAz5saZPbJJPBQVOiDlkkG6ULpwTeoSMw XtUQ== 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=YeE+/BVUjXzXtoRPrMlnZ7zrvZqFsthbg+ijCE7TqkE=; b=tduUAbDCZwSLyj10UV6dYTupw2X/Ye99WoJli1yeirQ4cHPDw3k97lpYG4PftSxp9u 7w/8WXciYY6GIZidOHsxPcn/gWo9OyPCCe0UKWbYkkAYNT5Hu+cONgn1AOR3bcktoHRB adqG4p3ZNO6u2YPta0Fk7yGJAMKhV80HzFYZxixG3P1NoMm1SS2GzNHJCwdGNwHFsrO0 TCjOaqeuS1bffkpFIS3XrX711gtXBb9ewZKL4eTHZg0yGgkm51jTKV2yFrQSmTAT7T2V CYri47jmpwfTSjvvlx2PfPi+2zNlFhSGiIlzh3txjII+H0WWqYqW7shmuqejn/0A2rfZ FVyg== X-Gm-Message-State: APjAAAXibtNeR+Moa0TVDMy2gAM4SS3nTfXmTzZQ+dW5bEXNoD0G22/J wheFuo0Af85K/933YUVEqYk= X-Google-Smtp-Source: APXvYqzidEmmo4dGcjD8hqfuWmHMMckOVMctao7b/Y+OQPZOAMGWxj6UH43Tbs1cTi14VEWrIBrh8A== X-Received: by 2002:adf:ea4a:: with SMTP id j10mr1027982wrn.114.1559479286990; Sun, 02 Jun 2019 05:41:26 -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 g185sm11214827wmf.30.2019.06.02.05.41.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 05:41:26 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: "Darrick J . Wong" , Dave Chinner , Olga Kornievskaia , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v3 4/6] common/rc: check support for xfs_io copy_range -f N Date: Sun, 2 Jun 2019 15:41:12 +0300 Message-Id: <20190602124114.26810-5-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602124114.26810-1-amir73il@gmail.com> References: <20190602124114.26810-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 Implement "_require_xfs_io_command copy_range -f" to check for the option added by following xfsprogs commit: xfs_io: allow passing an open file to copy_range Signed-off-by: Amir Goldstein --- common/rc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/rc b/common/rc index 17b89d5d..0d26b0fc 100644 --- a/common/rc +++ b/common/rc @@ -2086,9 +2086,16 @@ _require_xfs_io_command() ;; "copy_range") local testcopy=$TEST_DIR/$$.copy.xfs_io + local copy_opts=$testfile + if [ "$param" == "-f" ]; then + # source file is the open destination file + testcopy=$testfile + copy_opts="0 -d 4k" + fi $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1 - testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` + testio=`$XFS_IO_PROG -F -f -c "copy_range $param $copy_opts" $testcopy 2>&1` rm -f $testcopy > /dev/null 2>&1 + param_checked=1 ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1` From patchwork Sun Jun 2 12:41:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10971759 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 562FD912 for ; Sun, 2 Jun 2019 12:41:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4510828BA0 for ; Sun, 2 Jun 2019 12:41:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 387C228BCE; Sun, 2 Jun 2019 12:41:32 +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 89C5A28BA0 for ; Sun, 2 Jun 2019 12:41:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726547AbfFBMlb (ORCPT ); Sun, 2 Jun 2019 08:41:31 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:34906 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbfFBMlb (ORCPT ); Sun, 2 Jun 2019 08:41:31 -0400 Received: by mail-wm1-f68.google.com with SMTP id c6so5697585wml.0; Sun, 02 Jun 2019 05:41:29 -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=rJTcx+QzDUIMX5pQIjEFkRKj1eFGDG37A3wUmJBpxTY=; b=EExG5bxkyS06/4Dp2cPnKXZYt3Tc6Map4IbrFIPXJb9s6MKC2uDvlISOMy105IlXyl clgF5VUw9lBJotxbSbM+Pezc02/jCSjbkfFECpCATqUNN/nyhyFDBw0XFbA2ElzwoLPo nzB58m9ApsaaZnoV3TLrHXakazuBJ8/pUdaHEDu08X0eMjRP+daYwnU30kmAk1H2fpjx bfljTGf9vG55o1iMJonuFO8C4pFc80xT5Gdyej4yj/Z+TfiwQPfwfjjdaaJlgqSWRdEi 3W2ou0fey9zvCUWC7gvLCDN5ykVkiQMxI11AK3BeWtHR/H0qlEVY7bhSvn6uiaKLTA4C LeoQ== 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=rJTcx+QzDUIMX5pQIjEFkRKj1eFGDG37A3wUmJBpxTY=; b=feKSuprnZp89FWYD8hb6qw3J4jiIYIOq6TRTdYs8dxBgktoEA5dwC1cVDbgKFxPIyD 46eRVFlW15sq4RF1ObYNJS1FbGDlpr42yOK3hVhUZHCQnuAaTRKXAPmGYHDQOXccaaFW kQtMEOdKdDWbBWwBR8VWrPULZoDMEXfaJ2gk7eT23UJIwajcdzU18ioWGeUqQ899WDr0 RnHT4tHLMdsihVmrGSDNGLJCA0pGh38PDhEnartEUo9l0pX6lkcXWU3IJNIi2XKnPrEd CKMTxFJHTgOYQqKOm9cZmjk+IZ6wU2goVAuGz/5WNPwkiBLeY5RN4puHNYQHu+IcqH+I ZQeg== X-Gm-Message-State: APjAAAVkhRfuAZcYD8yQnpKnU9RnYPE3Yd8BEgLuXSlvFI4sdXynaGxi JdNs8ZTH4TJiqr83iZVUGuk= X-Google-Smtp-Source: APXvYqwwx/N46DSzmeO0t4OCuCqJyTgnJlsVDPhTl/dDxERXv59x1xaCeziaVQCG5UjmakAZGwjIaQ== X-Received: by 2002:a1c:23c4:: with SMTP id j187mr11593528wmj.176.1559479288529; Sun, 02 Jun 2019 05:41:28 -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 g185sm11214827wmf.30.2019.06.02.05.41.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 05:41:27 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: "Darrick J . Wong" , Dave Chinner , Olga Kornievskaia , fstests@vger.kernel.org, linux-xfs@vger.kernel.org, Dave Chinner Subject: [PATCH v3 5/6] generic: copy_file_range bounds test Date: Sun, 2 Jun 2019 15:41:13 +0300 Message-Id: <20190602124114.26810-6-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602124114.26810-1-amir73il@gmail.com> References: <20190602124114.26810-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. Add requirements needed for large size copy tests and fifo test. Signed-off-by: Dave Chinner Signed-off-by: Amir Goldstein --- tests/generic/990 | 132 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/990.out | 37 ++++++++++++ tests/generic/group | 1 + 3 files changed, 170 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..821aa10b --- /dev/null +++ b/tests/generic/990 @@ -0,0 +1,132 @@ +#! /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 +# For blockdev copy test case +_require_loop +# +# This test effectively requires xfs_io with these commits +# 2a42470b xfs_io: copy_file_range length is a size_t +# 1a05efba io: open pipes in non-blocking mode +# +# Without those commits test will hang on old kernel when copying +# very large size and when copying from a pipe. +# +# We require a new xfs_io feature of passing an open file as the +# copy source, as an indication that the test can run without hanging +# with large size argument and to avoid opening pipe in blocking mode. +# +_require_xfs_io_command "copy_range" "-f" + +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 +# We need to use an existing major number otherwise we get ENXIO +# so we _require_loop and use a loop device major number. +# We are not going to do I/O so minor number doesn't matter. +mknod $testdir/dev1 b 7 123 +$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 +# Pass input pipe as non-blocking open file to avoid old xfs_io (<4.20) +# opening the pipe in blocking mode and causing the test to hang +$XFS_IO_PROG -r -n -f -c "open $testdir/copy" -C "copy_range -l 32k -f 0" $testdir/fifo + +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 Jun 2 12:41:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10971763 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 C61E818A6 for ; Sun, 2 Jun 2019 12:41:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B462528BA0 for ; Sun, 2 Jun 2019 12:41:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0B0A28BBD; Sun, 2 Jun 2019 12:41:32 +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 34D9D28BCD for ; Sun, 2 Jun 2019 12:41:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbfFBMlb (ORCPT ); Sun, 2 Jun 2019 08:41:31 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44718 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726485AbfFBMlb (ORCPT ); Sun, 2 Jun 2019 08:41:31 -0400 Received: by mail-wr1-f66.google.com with SMTP id w13so9429807wru.11; Sun, 02 Jun 2019 05:41:30 -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=iXL7h8ypG8InUTHRfiClRAyEZN8C7dteH5eN9LzW4jrc2HK+Jr7J4b8scY9CBmMAWk FfsGddp84we9wqQQBu9XkM8aRgesnJ7JmjXJwfHBr9TL5yAWSS4PUk0P6uHeAsYYOJ+z 7UDmPOFj+qk3VbQfzsqxCSvOTnV5yzeAuGyLk+Xbdi9Amv5GKqdZ0uZYkQDCqXlAcBcr 6L62CbxOZ5wySAFpHvULSmxw1ijN4nq1eN8W/FD7VioIXhiN72J83Zpm5msH/Uy3gt1d QQjCnpdXZdsua0630oKHV2ZZbeHFp5oyFD0HTEqbCcCXrKj9StO21hd59XFg/5LjY9Fr 5yww== 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=PxFETq9D9VPC1M3WfXCTekFruyLS9qdc756hqotifgkGYvrLXPxPdGh+bjsjHdOFJs pmJOzCYtJEgkCINgf/5b2GeI7ai2LdBU55bfxtlypsFQG7vp7kxXiut01XavIJjYfdlH 6UeuxLQt6nHr2OYXF0tWR3S5O4Azd8nyb6PgqB7j6VbXPs54XGDEhdIz2hzPOO5ipf4/ aU8UAa/Vpg7v0KcLdwqJS/mh4yof7N2NcMhnMIMZj0chLu/YLJkD2WMNCfLBJkVTrNQd D8UKT3o2yCVURdWvGSJv5ifRsrd0JX5754DSIxV+tGcZLVK4L17/j5Uf8E9p2JM9S/Rt Lt3A== X-Gm-Message-State: APjAAAW+BQBEiP/WcsRQwdIQoDNbo23rtervM+PWM0nW42e28BhsM1eD 6kJJRwuygwdTDmurhvaUiXg= X-Google-Smtp-Source: APXvYqyML6BT7av3tb+8l4fXkBDQfHD18QUHUQBMvtOyMdcfTEaUD2k79MsiZ6INwWqfNfOuLod/hg== X-Received: by 2002:a5d:4f8b:: with SMTP id d11mr2627736wru.264.1559479289996; Sun, 02 Jun 2019 05:41:29 -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 g185sm11214827wmf.30.2019.06.02.05.41.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 05:41:29 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: "Darrick J . Wong" , Dave Chinner , Olga Kornievskaia , fstests@vger.kernel.org, linux-xfs@vger.kernel.org, Dave Chinner Subject: [PATCH v3 6/6] generic: cross-device copy_file_range test Date: Sun, 2 Jun 2019 15:41:14 +0300 Message-Id: <20190602124114.26810-7-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190602124114.26810-1-amir73il@gmail.com> References: <20190602124114.26810-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