From: "Darrick J. Wong" <djwong@kernel.org>
To: fdmanana@kernel.org
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] generic: test replacing a xattr with a larger value
Date: Fri, 25 Sep 2026 13:05:57 -0700 [thread overview]
Message-ID: <20260925200557.GP6253@frogsfrogsfrogs> (raw)
In-Reply-To: <7d2caec7b8ecd95ad63fcbbc7e1cc1c84ee50d7f.1790356355.git.fdmanana@suse.com>
On Fri, Sep 25, 2026 at 06:16:36PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> Test that replacing a xattr's value with a larger value works. This is a
> test that exercises a specific scenario on btrfs where two xattrs are
> stored in the same item, and for that to happen their names must result
> in the same crc32c hash.
>
> This was recently fixed by the following patch:
>
> "btrfs: fix xattr replace when multiple xattrs are packed in the same item"
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
>
> V2: Fix missing _ on _fixed_by_fs_commit call.
>
> tests/generic/806 | 43 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/806.out | 11 +++++++++++
> 2 files changed, 54 insertions(+)
> create mode 100755 tests/generic/806
> create mode 100644 tests/generic/806.out
>
> diff --git a/tests/generic/806 b/tests/generic/806
> new file mode 100755
> index 00000000..1fcf0145
> --- /dev/null
> +++ b/tests/generic/806
> @@ -0,0 +1,43 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 SUSE S.A. All Rights Reserved.
> +#
> +# FS QA Test 806
> +#
> +# Test replacing a xattr's value with a larger value.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick metadata attr
> +
> +. ./common/filter
> +. ./common/attr
> +
> +_require_scratch
> +_require_attrs
> +
> +_fixed_by_fs_commit btrfs xxxxxxxxxxxx \
> + "btrfs: fix xattr replace when multiple xattrs are packed in the same item"
> +
> +_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
> +_scratch_mount
> +
> +touch $SCRATCH_MNT/testfile
> +
> +# Add two xattrs that, on btrfs, have the same hash (crc32c) for their name
> +# and therefore are packed into the same btrfs_dir_item.
> +$SETFATTR_PROG -n user.foobar -v 123 $SCRATCH_MNT/testfile
> +$SETFATTR_PROG -n user.WvG1c1Td -v qwerty $SCRATCH_MNT/testfile
Heh, glad there's a test for this sort of collision thing. :)
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> +
> +# Verify the xattrs are present.
> +echo "xattrs before:"
> +_getfattr --absolute-names --dump $SCRATCH_MNT/testfile | _filter_scratch
> +
> +# Now replace the value of the foobar xattr with a significantly larger value.
> +$SETFATTR_PROG -n user.foobar -v abcdefghijklmnopqrstuvwxyz $SCRATCH_MNT/testfile
> +
> +# Check the xattrs have the expected values.
> +echo "xattrs after:"
> +_getfattr --absolute-names --dump $SCRATCH_MNT/testfile | _filter_scratch
> +
> +# success, all done
> +_exit 0
> diff --git a/tests/generic/806.out b/tests/generic/806.out
> new file mode 100644
> index 00000000..620a953e
> --- /dev/null
> +++ b/tests/generic/806.out
> @@ -0,0 +1,11 @@
> +QA output created by 806
> +xattrs before:
> +# file: SCRATCH_MNT/testfile
> +user.WvG1c1Td="qwerty"
> +user.foobar="123"
> +
> +xattrs after:
> +# file: SCRATCH_MNT/testfile
> +user.WvG1c1Td="qwerty"
> +user.foobar="abcdefghijklmnopqrstuvwxyz"
> +
> --
> 2.47.2
>
>
next prev parent reply other threads:[~2026-09-25 20:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 16:50 [PATCH] generic: test replacing a xattr with a larger value fdmanana
2026-09-25 17:16 ` [PATCH v2] " fdmanana
2026-09-25 20:05 ` Darrick J. Wong [this message]
2026-09-26 5:58 ` Qu Wenruo
2026-09-26 18:19 ` Filipe Manana
2026-09-27 11:44 ` Zorro Lang
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=20260925200557.GP6253@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fdmanana@kernel.org \
--cc=fstests@vger.kernel.org \
--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