linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Eryu Guan <guan@eryu.me>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Add test for rename exchange behavior between subvolumes
Date: Mon, 30 Aug 2021 10:10:51 +0300	[thread overview]
Message-ID: <1f480dc9-e3a2-90a8-27c5-b8090a5ff9c6@suse.com> (raw)
In-Reply-To: <YSuUAT27PfryyyRq@desktop>



On 29.08.21 г. 17:04, Eryu Guan wrote:
> On Thu, Aug 19, 2021 at 04:14:56PM +0300, Nikolay Borisov wrote:
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> 
> I noticed that test currently fails with v5.15-rc6 kernel as
> 
>   cross-subvol tree/symb -> Invalid cross-device link
>   cross-subvol tree/dire -> Invalid cross-device link
>   cross-subvol tree/tree -> Invalid cross-device link
>  -Invalid cross-device link---
> 
> So is there any background info about this test? Is it motivated by a
> known bug? If so is there a proposed fix available?
> 
> Some descriptions would be good in commit log.
> 
>>  tests/btrfs/246     | 46 +++++++++++++++++++++++++++++++++++++++++++++
>>  tests/btrfs/246.out | 27 ++++++++++++++++++++++++++
>>  2 files changed, 73 insertions(+)
>>  create mode 100755 tests/btrfs/246
>>  create mode 100644 tests/btrfs/246.out
>>
>> diff --git a/tests/btrfs/246 b/tests/btrfs/246
>> new file mode 100755
>> index 000000000000..0934932d1f22
>> --- /dev/null
>> +++ b/tests/btrfs/246
>> @@ -0,0 +1,46 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2021 SUSE Linux Products GmbH.  All Rights Reserved.
>> +#
>> +# FS QA Test 246
>> +#
>> +# Tests rename exchange behavior across subvolumes 
> 
> Trailing white space in above line
> 
>> +#
>> +. ./common/preamble
>> +_begin_fstest auto quick rename
> 
> Should be in 'subvol' group as well.
> 
>> +
>> +# Import common functions.
>> + . ./common/renameat2
>> +
>> +# real QA test starts here
>> +
>> +# Modify as appropriate.
>> +_supported_fs btrfs
>> +_require_renameat2 exchange
>> +_require_scratch
>> +
>> +_scratch_mkfs >> $seqres.full 2>&1
>> +_scratch_mount
>> +
>> +# Create 2 subvols to use as parents for the rename ops
>> +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol1 1>/dev/null
>> +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol2 1>/dev/null
> 
> The "1" in "1>/dev/null" could be dropped.

Nope, that's intentional because I want to disregard the usual output of:
Create subvolume '/media/scratch/subvol1'

Yet in case an error occurs I want it to fail the test.



> 
>> +
>> +# _rename_tests_source_dest internally expects the flags variable to contain
>> +# specific options to rename syscall. Ensure cross subvol ops are forbidden
>> +flags="-x"
>> +_rename_tests_source_dest $SCRATCH_MNT/subvol1/src $SCRATCH_MNT/subvol2/dst "cross-subvol"
> 
> I think _rename_tests_source_dest should be updated to take flags as
> arguments instead of inheriting $flags variable from caller. That could
> be done in a separate patch as preparation.

I agree, will implement this.

<snip>

>> +sync
> 
> A global sync seems a bit heavy, does syncfs on scratch fs work? Or does
> umounting scratch dev work? If so we could depend on the test harness to
> umount scratch dev after each test.

Yeah, the unmount at the end of the test is sufficient to trigger the
failure.

<snip>

      reply	other threads:[~2021-08-30  7:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 13:14 [PATCH] btrfs: Add test for rename exchange behavior between subvolumes Nikolay Borisov
2021-08-23 15:49 ` Filipe Manana
2021-08-30  7:18   ` Nikolay Borisov
2021-08-30 10:56     ` Filipe Manana
2021-08-30 11:08       ` Nikolay Borisov
2021-08-30 11:11         ` Filipe Manana
2021-08-29 14:04 ` Eryu Guan
2021-08-30  7:10   ` Nikolay Borisov [this message]

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=1f480dc9-e3a2-90a8-27c5-b8090a5ff9c6@suse.com \
    --to=nborisov@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-btrfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).