Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sahaj Chaudhari" <sahaj123.sc@gmail.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH v2] ext4: test reserved GID block allocation
Date: Sat, 07 Nov 2026 19:41:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-203218@kernel.org> (raw)
In-Reply-To: <20261107193050.330685-1-sahaj123.sc@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ext4/309: hardcoded ^has_journal and unchecked mkfs/tune2fs
  break test
- [Low] ext4/309: unverified su -g/-G support and unchecked space-fill
  step
--

commit 6c6eb6186b8e8ccb5609d413ece36c644ad760e0
Author: Sahaj Chaudhari <sahaj123.sc@gmail.com>

ext4: test reserved GID block allocation

This commit adds xfstests test ext4/309 to verify that a user whose primary
and supplementary group matches the superblock s_resgid can allocate blocks
from the reserved pool after ordinary free space is exhausted.

Link: https://lore.kernel.org/r/20261008065651.3517824-1-sahaj123.sc@gmail.com

> diff --git a/tests/ext4/309 b/tests/ext4/309
> new file mode 100755
> index 0000000000000..3bd120091202b
> --- /dev/null
> +++ b/tests/ext4/309
> @@ -0,0 +1,63 @@

[ ... ]

> +MKFS_OPTIONS="-m 10 -N 1024 -O ^has_journal $MKFS_OPTIONS" \
> +	_scratch_mkfs_sized $((16 * 1024 * 1024)) 4096 >>"$seqres".full 2>&1
> +"$TUNE2FS_PROG" -u 0 -g "$RESGID" "$SCRATCH_DEV" >>"$seqres".full 2>&1
> +_scratch_mount

[Severity: Medium]
Can formatting with -O ^has_journal here cause _scratch_mount to fail when
journal mount options are configured?

In __ext4_fill_super(), ext4 rejects mounting a journal-less filesystem
whenever any journal mount option (such as data=ordered, data=journal,
data=writeback, or commit=) is passed, which is not filtered out by
_exclude_scratch_mount_option.

Also, appending caller mkfs options after -m 10 -N 1024 -O ^has_journal lets
a preset such as -m 0 override the 10% reserved pool and cause the final
fallocate to fail.  Neither _scratch_mkfs_sized nor tune2fs checks its exit
status with _fail, so if mkfs fails on conflicting options (for example
-J size=... with -O ^has_journal), the test mounts the stale filesystem left
on the scratch device and fails when 16M does not fill it.

> +
> +touch "$TEST_FILE"
> +chmod 0666 "$TEST_FILE"
> +
> +su -s /bin/bash -g "$FILL_GROUP" -G "$FILL_GROUP" "$qa_user" -c \
> +	"$XFS_IO_PROG -f -c 'pwrite 0 16M' '$TEST_FILE'" \
> +	>>"$seqres".full 2>&1
> +
> +if su -s /bin/bash -g "$FILL_GROUP" -G "$FILL_GROUP" "$qa_user" -c \
> +	"$XFS_IO_PROG -c 'falloc 16M 4k' '$TEST_FILE'" \
> +	>>"$seqres".full 2>&1; then
> +	_fail "ordinary user allocated from the reserved pool"
> +fi
> +
> +su -s /bin/bash -g "$RES_GROUP" -G "$RES_GROUP" "$qa_user" -c \
> +	"$XFS_IO_PROG -c 'falloc 16M 4k' '$TEST_FILE'" \
> +	>>"$seqres".full 2>&1 || _fail "reserved GID failed to allocate a block"

[Severity: Low]
What happens if su does not support -g and -G, or if $qa_user cannot
traverse the scratch mount point?

The -g and -G flags are specific to util-linux su and are not checked before
use.  Because the pwrite step does not verify that any data was written and
the first falloc check treats any non-zero exit status from su as space
exhaustion, an early su or permission failure falls through to the final
step and fails with "reserved GID failed to allocate a block".

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261107193050.330685-1-sahaj123.sc@gmail.com?part=1

  reply	other threads:[~2026-11-07 19:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261012112109.3363168-1-sahaj123.sc@gmail.com>
2026-11-07 19:30 ` [PATCH v2] ext4: test reserved GID block allocation Sahaj Chaudhari
2026-11-07 19:41   ` sashiko-bot [this message]
2026-11-09 13:08   ` Jan Kara
2026-11-09 15:54   ` Zorro Lang
2026-11-10 18:52   ` Sahaj Chaudhari

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-203218@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sahaj123.sc@gmail.com \
    --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