From: sashiko-bot@kernel.org
To: arzuagapozosergio@gmail.com
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH v3] ext4: bound xattr journal credits to transaction limit
Date: Sun, 22 Nov 2026 09:53:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-227865@kernel.org> (raw)
In-Reply-To: <20261122093732.136895-1-arzuagapozosergio@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] selftests/ext4: duplicate skips and false pass in main() on
shared-block errors
- [Medium] selftests/ext4: prepare_shared_file() stores large_name in
inode body not block
--
commit acc0f729809bd687fef099d47921332f19729aeb
Author: Ryuji Hiroshi <arzuagapozosergio@gmail.com>
ext4: bound xattr journal credits to transaction limit
This commit refines ext4 xattr journal credit estimation by accounting for an
existing ea_inode reference only when the target attribute currently points to
one and bounding the estimate against the JBD2 transaction buffer limit, along
with adding an ext4 selftest.
Link: https://syzbot.org/bug?extid=25d45c0bd716f2b794a7
> diff --git a/tools/testing/selftests/filesystems/ext4/ext4_xattr_journal_credits.c b/tools/testing/selftests/filesystems/ext4/ext4_xattr_journal_credits.c
> new file mode 100644
> index 0000000000000..313e817671ac3
> --- /dev/null
> +++ b/tools/testing/selftests/filesystems/ext4/ext4_xattr_journal_credits.c
> @@ -0,0 +1,244 @@
[ ... ]
> +#define LARGE_VALUE_SIZE 65296
> +#define FILLER_VALUE_SIZE 32
> +#define TEST_COUNT 10
> +
> +static const char large_name[] = "user.ext4-credit-large";
> +static const char small_name[] = "user.ext4-credit-small";
> +static const char target_name[] = "user.ext4-credit-target";
> +static const char filler_name[] = "user.ext4-credit-filler";
[ ... ]
> +static void report_setup_error(const char *what, unsigned int skip_count)
> +{
> + int saved_errno = errno;
> + unsigned int i;
> +
> + ksft_test_result_error("setup %s: %s\n", what,
> + strerror(saved_errno));
> + for (i = 0; i < skip_count; i++)
> + ksft_test_result_skip("setup failed\n");
> +}
> +
> +static bool prepare_shared_file(const char *path, const char *large_value,
> + const char *filler, char target_value)
> +{
> + return create_file(path) == 0 &&
> + set_xattr(path, target_name, &target_value, sizeof(target_value),
> + XATTR_CREATE) &&
> + set_xattr(path, filler_name, filler, FILLER_VALUE_SIZE,
> + XATTR_CREATE) &&
> + set_xattr(path, large_name, large_value, LARGE_VALUE_SIZE,
> + XATTR_CREATE);
> +}
[Severity: Medium]
Does prepare_shared_file() place large_name into the inode body instead of
the shared external xattr block?
On a 256-byte inode with i_extra_isize = 32, 88 bytes are available for xattr
entries and values in the inode body. target_name uses 40 bytes, leaving 48
bytes free. Because filler_name with FILLER_VALUE_SIZE = 32 needs 68 bytes,
ext4_xattr_ibody_set() returns -ENOSPC and spills filler_name to the external
xattr block without consuming the remaining 48 bytes in the inode body. When
large_name is added next, its value is stored in an ea_inode (i.in_inode = 1),
so its entry needs only 36 bytes in the xattr table and fits into the inode
body. As a result, the shared external xattr block only contains filler_name
with e_value_inum == 0, and the test never exercises the block_bh e_value_inum
credit loop in __ext4_xattr_set_credits() or ea_inode refcount updates during
block cloning.
[ ... ]
> + if (prepare_shared_block(shared_a, shared_b, value, readback)) {
> + shared_ready = true;
> + ksft_test_result_pass("shared external xattr block fixture\n");
> + } else {
> + report_setup_error("prepare shared xattr block", 2);
> + }
> +
> + if (shared_ready) {
> + memset(target_new, 0x22, sizeof(target_new));
> + shared_replaced = set_xattr(shared_a, target_name, target_new,
> + sizeof(target_new), XATTR_REPLACE);
> + result(shared_replaced,
> + "replace inode-body xattr with shared external block present");
> +
> + result(xattr_matches(shared_a, target_name, readback,
> + shared_replaced ? target_new : &target_old,
> + shared_replaced ? sizeof(target_new) :
> + sizeof(target_old)) &&
> + xattr_matches(shared_b, target_name, readback,
> + &target_old, sizeof(target_old)) &&
> + xattr_matches(shared_b, large_name, readback, value,
> + LARGE_VALUE_SIZE),
> + "xattr block clone preserves both files' values");
> + } else {
> + ksft_test_result_skip("shared-block replacement needs its fixture\n");
> + ksft_test_result_skip("shared-block readback needs its fixture\n");
> + }
[Severity: Medium]
When prepare_shared_block() fails, does calling report_setup_error(..., 2)
and then entering the !shared_ready branch emit four skip results instead of
two?
That produces 12 TAP results for a 10-test plan and inflates
ksft_cnt.ksft_xskip, which can make ksft_finished() compute
ksft_pass + ksft_xskip == ksft_plan and exit with 0 even when earlier tests
failed or errored.
Also, in the shared_ready branch, falling back to &target_old when
shared_replaced is false causes "xattr block clone preserves both files'
values" to report a pass when the replacement failed and no block clone took
place.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261122093732.136895-1-arzuagapozosergio@gmail.com?part=1
prev parent reply other threads:[~2026-11-22 9:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 7:53 [PATCH] ext4: bound xattr journal credits to transaction limit arzuagapozosergio
2026-11-22 8:09 ` sashiko-bot
2026-11-22 8:49 ` [PATCH v2] " arzuagapozosergio
2026-11-22 9:09 ` sashiko-bot
2026-11-22 9:37 ` [PATCH v3] " arzuagapozosergio
2026-11-22 9:53 ` sashiko-bot [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=sashiko-outbox-227865@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arzuagapozosergio@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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