All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "Darrick J . Wong" <darrick.wong@oracle.com>,
	Dave Chinner <david@fromorbit.com>,
	Olga Kornievskaia <olga.kornievskaia@gmail.com>,
	fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH v3 2/6] generic: copy_file_range immutable file test
Date: Sat, 8 Jun 2019 01:10:37 +0800	[thread overview]
Message-ID: <20190607171037.GW15846@desktop> (raw)
In-Reply-To: <20190602124114.26810-3-amir73il@gmail.com>

On Sun, Jun 02, 2019 at 03:41:10PM +0300, Amir Goldstein wrote:
> 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.

I think this description should go below "---" and not be in the commit
log. I copied the test description from test here instead.

> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  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"

I renamed "testdir" to "workdir" to avoid confusing with TEST_DIR, and
moved the definition before _cleanup so we have a valid workdir
definition if any of the requires are not met.

Thanks,
Eryu

> +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
> -- 
> 2.17.1
> 

  reply	other threads:[~2019-06-07 17:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-02 12:41 [PATCH v3 0/6] fstests: copy_file_range() tests Amir Goldstein
2019-06-02 12:41 ` [PATCH v3 1/6] generic: create copy_range group Amir Goldstein
2019-06-02 12:41 ` [PATCH v3 2/6] generic: copy_file_range immutable file test Amir Goldstein
2019-06-07 17:10   ` Eryu Guan [this message]
2019-06-02 12:41 ` [PATCH v3 3/6] generic: copy_file_range swapfile test Amir Goldstein
2019-06-10  3:58   ` Theodore Ts'o
2019-06-10  6:37     ` Amir Goldstein
2019-06-10  9:08       ` Amir Goldstein
2019-06-10 13:31       ` Theodore Ts'o
2019-06-10 16:06         ` Darrick J. Wong
2019-06-10 16:54           ` Amir Goldstein
2019-06-10 17:04             ` Darrick J. Wong
2019-06-11  2:13           ` Eryu Guan
2019-06-11  2:12         ` Eryu Guan
2019-06-11  2:36           ` Eryu Guan
2019-06-02 12:41 ` [PATCH v3 4/6] common/rc: check support for xfs_io copy_range -f N Amir Goldstein
2019-06-02 12:41 ` [PATCH v3 5/6] generic: copy_file_range bounds test Amir Goldstein
2019-06-02 12:41 ` [PATCH v3 6/6] generic: cross-device copy_file_range test Amir Goldstein
2019-06-09 13:46 ` [PATCH v3 0/6] fstests: copy_file_range() tests Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607171037.GW15846@desktop \
    --to=guaneryu@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=olga.kornievskaia@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.