* Re: [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c
From: Theodore Tso @ 2026-05-28 14:56 UTC (permalink / raw)
To: Abdellah Ouhbi; +Cc: linux-ext4, linux-kernel, skhan, me, linux-kernel-mentees
In-Reply-To: <20260424152245.142308-1-abdououhbi1@gmail.com>
On Fri, Apr 24, 2026 at 04:22:45PM +0100, Abdellah Ouhbi wrote:
> Fix coccicheck warning
> ./namei.c:150:25-32: WARNING: Consider using %pe to print PTR_ERR()
>
> Replace %ld with %pe and PTR_ERR(bh) with bh pointer.
> The %pe specifier automatically converts error pointers to
> human-readable error names instead of raw error codes.
>
> Signed-off-by: Abdellah Ouhbi <abdououhbi1@gmail.com>
I've folded the three patches you had sent into a single commit. For
this kind of cleanup, there's no reason to have separate patches for
each file.
Thanks,
- Ted
^ permalink raw reply
* Re: [PATCH v10 00/22] fs-verity support for XFS with post EOF merkle tree
From: Andrey Albershteyn @ 2026-05-28 14:50 UTC (permalink / raw)
To: Christian Brauner
Cc: Carlos Maiolino, Christoph Hellwig, Andrey Albershteyn, linux-xfs,
fsverity, linux-fsdevel, ebiggers, linux-ext4, linux-f2fs-devel,
linux-btrfs, linux-unionfs, djwong, david
In-Reply-To: <20260528-offiziell-luftleer-misswirtschaft-3503bda2ad70@brauner>
On 2026-05-28 14:20:08, Christian Brauner wrote:
> On Tue, May 26, 2026 at 12:19:43PM +0200, Carlos Maiolino wrote:
> > On Fri, May 22, 2026 at 02:07:57PM +0200, Christoph Hellwig wrote:
> > > On Fri, May 22, 2026 at 12:03:20PM +0200, Christian Brauner wrote:
> > > > > I was expecting this to come through xfs tree too if Eric and Christian
> > > > > agree.
> > > >
> > > > You may take it through the xfs tree if there are no conflicts with
> > > > vfs-7.2.iomap. If there are I want to add the iomap changes into
> > > > vfs-7.2.iomap that you can pull in.
> > >
> > > Merging the iomap bits through the iomap branch might make sense, given
> > > that iomap usually tends to see quite a bit of activity.
> > >
> >
> > That sounds good to me. If you want to go ahead and pull in the iomap
> > bits, do so, and give me a heads up when you do it so I'll pull your
> > branch locally.
>
> Great, can the series please be resent based on current vfs-7.2.iomap
> then please? Because the iomap changes in this series don't apply
> cleanly on vfs-7.2.iomap so we already have merge conflicts...
>
hmm do you mean this branch?
https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-7.2.iomap
patches 07..09 seems to apply cleanly. The only conflict I see is in
the overlayfs patch 03. This is because [1] (is in -rc5) is missing
in vfs-7.2.iomap.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/overlayfs/util.c?h=v7.1-rc5&id=0c8c88b8eb82a2a41bec5f17c076d6312dc40316
--
- Andrey
^ permalink raw reply
* Re: [PATCH v3 0/2] ext4: add hash Kunit tests and optimize str2hashbuf
From: Theodore Ts'o @ 2026-05-28 14:38 UTC (permalink / raw)
To: Andreas Dilger, Baokun Li, Jan Kara, Ojaswin Mujoo,
Ritesh Harjani, Zhang Yi, Guan-Chun Wu
Cc: Theodore Ts'o, linux-ext4, linux-kernel, edward062254,
visitorckw, david.laight.linux
In-Reply-To: <20260413065114.730231-1-409411716@gms.tku.edu.tw>
On Mon, 13 Apr 2026 14:51:12 +0800, Guan-Chun Wu wrote:
> This series adds Kunit tests for fs/ext4/hash.c and refactors
> the str2hashbuf_{signed,unsigned}() helpers.
>
> Patch 1 adds test coverage for ext4fs_dirhash(), including the main
> hash variants and relevant edge cases.
>
> Patch 2 simplifies the str2hashbuf helper implementation by processing
> input in 4-byte chunks and removing function-pointer dispatch. This also
> reduces overhead and shows roughly 2x improvement on longer inputs in
> local testing.
>
> [...]
Applied, thanks!
[1/2] ext4: add Kunit coverage for directory hash computation
commit: a4841d91a7f57d38d3a63c18b4ce68ee5e06829b
[2/2] ext4: improve str2hashbuf by processing 4-byte chunks and removing function pointers
commit: d8c73397cc49362a88a57b67c11eff6e65b525e8
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply
* Re: [PATCH] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ()
From: Theodore Ts'o @ 2026-05-28 14:38 UTC (permalink / raw)
To: Andreas Dilger, Ryota Sakamoto
Cc: Theodore Ts'o, linux-ext4, linux-kernel
In-Reply-To: <20260127-fix-fs_ext4-memcmp-v1-1-5c269ae906b6@gmail.com>
On Tue, 27 Jan 2026 23:23:23 +0900, Ryota Sakamoto wrote:
> Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ() to improve
> debugging that prints the hex dump of the buffers when the assertion fails,
> whereas memcmp() only returns an integer difference.
Applied, thanks!
[1/1] ext4: Replace KUnit tests for memcmp() with KUNIT_ASSERT_MEMEQ()
commit: eef9fb4e19bf99252232339183ee167c63457c57
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply
* Re: [PATCH v10 00/22] fs-verity support for XFS with post EOF merkle tree
From: Andrey Albershteyn @ 2026-05-28 14:25 UTC (permalink / raw)
To: Christian Brauner
Cc: Carlos Maiolino, Christoph Hellwig, Andrey Albershteyn, linux-xfs,
fsverity, linux-fsdevel, ebiggers, linux-ext4, linux-f2fs-devel,
linux-btrfs, linux-unionfs, djwong, david
In-Reply-To: <20260528-offiziell-luftleer-misswirtschaft-3503bda2ad70@brauner>
On 2026-05-28 14:20:08, Christian Brauner wrote:
> On Tue, May 26, 2026 at 12:19:43PM +0200, Carlos Maiolino wrote:
> > On Fri, May 22, 2026 at 02:07:57PM +0200, Christoph Hellwig wrote:
> > > On Fri, May 22, 2026 at 12:03:20PM +0200, Christian Brauner wrote:
> > > > > I was expecting this to come through xfs tree too if Eric and Christian
> > > > > agree.
> > > >
> > > > You may take it through the xfs tree if there are no conflicts with
> > > > vfs-7.2.iomap. If there are I want to add the iomap changes into
> > > > vfs-7.2.iomap that you can pull in.
> > >
> > > Merging the iomap bits through the iomap branch might make sense, given
> > > that iomap usually tends to see quite a bit of activity.
> > >
> >
> > That sounds good to me. If you want to go ahead and pull in the iomap
> > bits, do so, and give me a heads up when you do it so I'll pull your
> > branch locally.
>
> Great, can the series please be resent based on current vfs-7.2.iomap
> then please? Because the iomap changes in this series don't apply
> cleanly on vfs-7.2.iomap so we already have merge conflicts...
>
Sure, I will resend soon.
--
- Andrey
^ permalink raw reply
* Re: [PATCH v4 18/23] ext4: wait for ordered I/O in the iomap buffered I/O path
From: Ojaswin Mujoo @ 2026-05-28 13:34 UTC (permalink / raw)
To: Zhang Yi
Cc: linux-ext4, linux-fsdevel, linux-kernel, tytso, adilger.kernel,
libaokun, jack, ritesh.list, djwong, hch, yi.zhang, yizhang089,
yangerkun, yukuai
In-Reply-To: <ahcUeq_IA_X988Ca@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>
On Wed, May 27, 2026 at 09:28:28PM +0530, Ojaswin Mujoo wrote:
> On Mon, May 11, 2026 at 03:23:38PM +0800, Zhang Yi wrote:
> > From: Zhang Yi <yi.zhang@huawei.com>
> >
> > For append writes, wait for ordered I/O to complete before updating
> > i_disksize. This ensures that zeroed data is flushed to disk before the
> > metadata update, preventing stale data from being exposed during
> > unaligned post-EOF append writes.
> >
> > Suggested-by: Jan Kara <jack@suse.cz>
> > Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> > ---
> > fs/ext4/ext4.h | 11 +++++++
> > fs/ext4/inode.c | 80 ++++++++++++++++++++++++++++++++++++++++++-----
> > fs/ext4/page-io.c | 60 +++++++++++++++++++++++++++++++++++
> > fs/ext4/super.c | 23 ++++++++++----
> > 4 files changed, 161 insertions(+), 13 deletions(-)
> >
> > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> > index 078feda47e36..9ce2128eea3e 100644
> > --- a/fs/ext4/ext4.h
> > +++ b/fs/ext4/ext4.h
> > @@ -1195,6 +1195,15 @@ struct ext4_inode_info {
> > #ifdef CONFIG_FS_ENCRYPTION
> > struct fscrypt_inode_info *i_crypt_info;
> > #endif
> > +
> > + /*
> > + * Track ordered zeroed data during post-EOF append writes, fallocate,
> > + * and truncate-up operations. These parameters are used only in the
> > + * iomap buffered I/O path.
> > + */
> > + ext4_lblk_t i_ordered_lblk;
> > + ext4_lblk_t i_ordered_len;
> > + wait_queue_head_t i_ordered_wq;
> > };
> >
> > /*
> > @@ -3858,6 +3867,8 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
> > __u64 len, __u64 *moved_len);
> >
> > /* page-io.c */
> > +#define EXT4_IOMAP_IOEND_ORDER_IO 1UL /* This I/O is an ordered one */
> > +
> > extern int __init ext4_init_pageio(void);
> > extern void ext4_exit_pageio(void);
> > extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags);
> > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> > index e013aeb03d7b..11fb369efeb1 100644
> > --- a/fs/ext4/inode.c
> > +++ b/fs/ext4/inode.c
> > @@ -4345,6 +4345,7 @@ static int ext4_iomap_writeback_submit(struct iomap_writepage_ctx *wpc,
> > {
> > struct iomap_ioend *ioend = wpc->wb_ctx;
> > struct ext4_inode_info *ei = EXT4_I(ioend->io_inode);
> > + ext4_lblk_t start, end, order_lblk, order_len;
> >
> > /*
> > * After I/O completion, a worker needs to be scheduled when:
> > @@ -4357,6 +4358,30 @@ static int ext4_iomap_writeback_submit(struct iomap_writepage_ctx *wpc,
> > test_opt(ioend->io_inode->i_sb, DATA_ERR_ABORT))
> > ioend->io_bio.bi_end_io = ext4_iomap_end_bio;
> >
> > + /*
> > + * Mark the I/O as ordered. Ordered I/O requires separate endio
> > + * handling and must not be merged with regular I/O operations.
> > + */
> > + order_len = READ_ONCE(ei->i_ordered_len);
> > + if (order_len) {
> > + /*
> > + * Pair with smp_store_release() in ext4_block_zero_eof().
> > + * Ensure we see the updated i_ordered_lblk that was written
> > + * before the release store to i_ordered_len.
> > + */
> > + smp_rmb();
> > + order_lblk = READ_ONCE(ei->i_ordered_lblk);
> > + start = ioend->io_offset >> ioend->io_inode->i_blkbits;
> > + end = EXT4_B_TO_LBLK(ioend->io_inode,
> > + ioend->io_offset + ioend->io_size);
> > +
> > + if (start <= order_lblk && end >= order_lblk + order_len) {
>
> Hi Zhang,
>
> I guess this check is enough cause ordered_lblk and ordered_len will
> always be contained in a single block.
>
> > + ioend->io_bio.bi_end_io = ext4_iomap_end_bio;
> > + ioend->io_private = (void *)EXT4_IOMAP_IOEND_ORDER_IO;
> > + ioend->io_flags |= IOMAP_IOEND_BOUNDARY;
>
> FWIU, we are wanting the ordered IO to not be merged and submitted asap
> since we want to wake up the waiters. Is there any other reason?
>
> Adding the boundary in ->writeback_submit() only affects
> iomap_ioend_can_merge() which happens after we have woken up the waiters
> and deferred the IO to the wq. We ideally want it affect
> iomap_can_add_to_ioend() ie we need to add IOMAP_F_BOUNDARY in
> ->writeback_range().
>
> Secondly, I don't think boundary is the right flag here. It ensures
> that everything before the ordered iomap gets submitted and the ordered
> iomap starts a new ioend. This can still keep getting merged with the
> newer ioends untils we decide to submit the IO, which can delay waking
> up the waiters. If we really want the "no merge" behavior, we'll have to
> do something like [1] (Check the 2 NOMERGE flag patches).
Hi Zhang, forgot to add this.
[1] https://github.com/OjaswinM/linux/commits/iomap-buffered-atomic-rfc2.3/
Also some more comments below:
>
> > + }
> > + }
> > +
> > return iomap_ioend_writeback_submit(wpc, error);
> > }
> >
> > @@ -4746,8 +4771,10 @@ static int ext4_iomap_submit_zero_block(struct inode *inode,
> > loff_t from, loff_t end)
> > {
> > struct address_space *mapping = inode->i_mapping;
> > + struct ext4_inode_info *ei = EXT4_I(inode);
> > struct folio *folio;
> > bool do_submit = false;
> > + int ret;
> >
> > folio = filemap_lock_folio(mapping, from >> PAGE_SHIFT);
> > if (IS_ERR(folio))
> > @@ -4757,14 +4784,50 @@ static int ext4_iomap_submit_zero_block(struct inode *inode,
> > folio_wait_writeback(folio);
> > WARN_ON_ONCE(folio_test_writeback(folio));
> >
> > - if (likely(folio_test_dirty(folio)))
> > + /*
> > + * Mark the ordered range. It will be cleared upon I/O completion
> > + * in ext4_iomap_end_bio(). Any operation that extends i_disksize
> > + * (including append write end io past the zeroed boundary,
> > + * truncate up and append fallocate) must wait for this I/O to
> > + * complete before updating i_disksize.
> > + *
> > + * When multiple overlapping unaligned EOF writes are in flight, we
> > + * only need to track and wait for the first one. Subsequent writes
> > + * will zero the gap in memory and ensure that the zeroed data is
> > + * written out along with the valid data in the same block before
> > + * i_disksize is updated.
> > + */
> > + if (likely(folio_test_dirty(folio) &&
> > + READ_ONCE(ei->i_ordered_len) == 0)) {
> > + WRITE_ONCE(ei->i_ordered_lblk,
> > + from >> inode->i_blkbits);
> > + /*
> > + * Pairs with smp_rmb() in ext4_iomap_writeback_submit()
> > + * and ext4_iomap_wb_ordered_wait(). Ensure the updated
> > + * i_ordered_lblk is visible when i_ordered_len becomes
> > + * non-zero.
> > + */
> > + smp_store_release(&ei->i_ordered_len, 1);
> > do_submit = true;
> > + }
> > folio_unlock(folio);
> > folio_put(folio);
> >
> > /* Submit zeroed block. */
> > - if (do_submit)
> > - return filemap_fdatawrite_range(mapping, from, end - 1);
> > + if (do_submit) {
> > + ret = filemap_fdatawrite_range(mapping, from, end - 1);
> > + if (ret) {
> > + /*
> > + * Pairs with wait_event() in
> > + * ext4_iomap_wb_ordered_wait(). Ensure
> > + * i_ordered_len = 0 is visible before waking up
> > + * waiters.
> > + */
> > + smp_store_release(&ei->i_ordered_len, 0);
> > + wake_up_all(&ei->i_ordered_wq);
> > + return ret;
Okay so even if the ordered IO fails we still let the i_disksize updates
go ahead? I think this is a deviation from the current behavior where we
abort the journal. If this is acceptable we should atleast add a comment
on why its okay.
> > + }
> > + }
> > return 0;
> > }
> >
> > @@ -4827,10 +4890,13 @@ int ext4_block_zero_eof(struct inode *inode, loff_t from, loff_t end)
> > * data=ordered mode. We submit zeroed range directly here.
> > * Do not wait for I/O completion for performance.
> > *
> > - * TODO: Any operation that extends i_disksize (including
> > - * append write end io past the zeroed boundary, truncate up,
> > - * and append fallocate) must wait for the relevant I/O to
> > - * complete before updating i_disksize.
> > + * The end_io handler ext4_iomap_wb_ordered_wait() will wait
> > + * for I/O completion before updating i_disksize if the write
> > + * extends beyond the zeroed boundary.
> > + *
> > + * TODO: Any other operation that extends i_disksize
> > + * (including truncate up and append fallocate) must wait for
> > + * the relevant I/O to complete before updating i_disksize.
> > */
> > } else if (ext4_inode_buffered_iomap(inode)) {
> > err = ext4_iomap_submit_zero_block(inode, from, end);
> > diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
> > index 3050c887329f..ad05ebb49bf6 100644
> > --- a/fs/ext4/page-io.c
> > +++ b/fs/ext4/page-io.c
> > @@ -613,6 +613,46 @@ int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio,
> > return 0;
> > }
> >
> > +/*
> > + * If the old disk size is not block size aligned and the current
> > + * writeback range is entirely beyond the old EOF block, we should
> > + * wait for the zeroed data written in ext4_block_zero_eof() to be
> > + * written out, otherwise, it may expose stale data in that block.
> > + */
> > +static void ext4_iomap_wb_ordered_wait(struct inode *inode,
> > + loff_t pos, loff_t end)
> > +{
> > + struct ext4_inode_info *ei = EXT4_I(inode);
> > + unsigned int blocksize = i_blocksize(inode);
> > + loff_t disksize = READ_ONCE(ei->i_disksize);
> > + ext4_lblk_t order_lblk, order_len;
> > +
> > + /*
> > + * Waiting for ordered I/O is unnecessary when:
> > + * - The on-disk size is block-aligned (no stale data exists).
> > + * - The write start is within the block of the old EOF
> > + * (overwriting, or appending to a block that already contains
> > + * valid data).
> > + */
> > + if (!(disksize & (blocksize - 1)) ||
> > + pos < round_up(disksize, blocksize))
> > + return;
Okay these checks are pretty confusing. I was intially thinking that
i_disksize's block would always be equal to i_ordered_lblk but seems
like that is not true because ext4_block_zero_eof() uses from=i_size.
So we could have a sequence where
1. truncate 4k (i_disksize = i_size = 4k)
2. write 8k,10k (i_disksize = 4k i_size = 10k, i_ordered_len = 0 (old isisze is block aligned))
3. write 16k,18k (i_disksize = 4k i_size = 10k, i_ordered_len = 1, lblk=4)
Here we issue ordered IO even though it' probably not needed. Now if
write 3 finishes first we see disksize as 4k so we don't wait for
ordered write. Which seems okay since we don't risk any stale data
exposure. However, this flow is pretty confuing.
Can't we somehow avoid having to issue/set ordered len/lblk in case it
is not really needed, like only issue it if i_disksize (and not i_size)
is unaligned. That can simplify some of our check and avoid extra IO
overhead.
> > +
> > + order_len = READ_ONCE(ei->i_ordered_len);
> > + if (!order_len)
> > + return;
> > +
> > + /*
> > + * Pair with smp_store_release() in ext4_iomap_end_bio() and
> > + * ext4_block_zero_eof(). Ensure we see the updated i_ordered_lblk
> > + * that was written before the release store to i_ordered_len.
> > + */
> > + smp_rmb();
> > + order_lblk = READ_ONCE(ei->i_ordered_lblk);
> > + if ((pos >> inode->i_blkbits) >= order_lblk + order_len)
> > + wait_event(ei->i_ordered_wq, READ_ONCE(ei->i_ordered_len) == 0);
> > +}
> > +
> > static int ext4_iomap_wb_update_disksize(handle_t *handle, struct inode *inode,
> > loff_t end)
> > {
> > @@ -656,6 +696,9 @@ static void ext4_iomap_finish_ioend(struct iomap_ioend *ioend)
> > goto out;
> > }
> >
> > + /* Wait ordered zero data to be written out. */
> > + ext4_iomap_wb_ordered_wait(inode, pos, pos + size);
> > +
> > /* We may need to convert one extent and dirty the inode. */
> > credits = ext4_chunk_trans_blocks(inode,
> > EXT4_MAX_BLOCKS(size, pos, inode->i_blkbits));
> > @@ -717,8 +760,25 @@ void ext4_iomap_end_bio(struct bio *bio)
> > struct inode *inode = ioend->io_inode;
> > struct ext4_inode_info *ei = EXT4_I(inode);
> > struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
> > + unsigned long io_mode = (unsigned long)ioend->io_private;
> > unsigned long flags;
> >
> > + /*
> > + * This is an ordered I/O, clear the ordered range set in
> > + * ext4_block_zero_eof() and wake up all waiters that will update
> > + * the inode i_disksize.
> > + */
> > + if (io_mode == EXT4_IOMAP_IOEND_ORDER_IO) {
> > + /*
> > + * Pairs with wait_event() in ext4_iomap_wb_ordered_wait().
> > + * Ensure i_ordered_len = 0 is visible before waking up
> > + * waiters.
> > + */
> > + smp_store_release(&ei->i_ordered_len, 0);
> > + wake_up_all(&ei->i_ordered_wq);
> > + goto defer;
> > + }
> > +
> > /* Needs to convert unwritten extents or update the i_disksize. */
> > if ((ioend->io_flags & IOMAP_IOEND_UNWRITTEN) ||
> > ioend->io_offset + ioend->io_size > READ_ONCE(ei->i_disksize))
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index 62bfe05a64bc..9c0a00e716f3 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -1444,6 +1444,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
> > ext4_fc_init_inode(&ei->vfs_inode);
> > spin_lock_init(&ei->i_fc_lock);
> > mmb_init(&ei->i_metadata_bhs, &ei->vfs_inode.i_data);
> > + ei->i_ordered_lblk = 0;
> > + ei->i_ordered_len = 0;
> > + init_waitqueue_head(&ei->i_ordered_wq);
> > return &ei->vfs_inode;
> > }
> >
> > @@ -1480,12 +1483,20 @@ static void ext4_destroy_inode(struct inode *inode)
> > dump_stack();
> > }
> >
> > - if (!(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ERROR_FS) &&
> > - WARN_ON_ONCE(EXT4_I(inode)->i_reserved_data_blocks))
> > - ext4_msg(inode->i_sb, KERN_ERR,
> > - "Inode %llu (%p): i_reserved_data_blocks (%u) not cleared!",
> > - inode->i_ino, EXT4_I(inode),
> > - EXT4_I(inode)->i_reserved_data_blocks);
> > + if (!(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ERROR_FS)) {
> > + if (WARN_ON_ONCE(EXT4_I(inode)->i_reserved_data_blocks))
> > + ext4_msg(inode->i_sb, KERN_ERR,
> > + "Inode %llu (%p): i_reserved_data_blocks (%u) not cleared!",
> > + inode->i_ino, EXT4_I(inode),
> > + EXT4_I(inode)->i_reserved_data_blocks);
> > +
> > + if (WARN_ON_ONCE(EXT4_I(inode)->i_ordered_len))
> > + ext4_msg(inode->i_sb, KERN_ERR,
> > + "Inode %llu (%p): i_ordered_lblk (%u) and i_ordered_len (%u) not cleared!",
> > + inode->i_ino, EXT4_I(inode),
> > + EXT4_I(inode)->i_ordered_lblk,
> > + EXT4_I(inode)->i_ordered_len);
> > + }
> > }
> >
> > static void ext4_shutdown(struct super_block *sb)
> > --
> > 2.52.0
> >
^ permalink raw reply
* Re: [PATCH 0/4] fs: mark selected blocking waits as freezable
From: Christian Brauner @ 2026-05-28 12:51 UTC (permalink / raw)
To: linux-fsdevel, viro, tytso, jack, linux-ext4, Dai Junbing
Cc: jack, linux-kernel
In-Reply-To: <20260527064912.1038-1-daijunbing@vivo.com>
On Wed, 27 May 2026 14:49:08 +0800, Dai Junbing wrote:
> fs: mark selected blocking waits as freezable
>
> Hi,
>
> During suspend and resume, tasks blocked in some interruptible wait
> paths may be unnecessarily woken due to freezer state transitions. This
> can introduce avoidable activity in the suspend/resume path.
>
> [...]
Applied to the vfs-7.2.misc branch of the vfs/vfs.git tree.
Patches in the vfs-7.2.misc branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.2.misc
[1/4] eventpoll: mark ep_poll() sleep as freezable
https://git.kernel.org/vfs/vfs/c/f5437433c37d
[2/4] jbd2: make kjournald2 commit wait freezable
https://git.kernel.org/vfs/vfs/c/10c6b259fb56
[3/4] pipe: mark blocking pipe read and FIFO open sleeps as freezable
https://git.kernel.org/vfs/vfs/c/6e5e03a76bee
[4/4] select: make select() and poll() waits freezable
https://git.kernel.org/vfs/vfs/c/f837c1dbd121
^ permalink raw reply
* Re: [PATCH v10 00/22] fs-verity support for XFS with post EOF merkle tree
From: Christian Brauner @ 2026-05-28 12:20 UTC (permalink / raw)
To: Carlos Maiolino
Cc: Christoph Hellwig, Andrey Albershteyn, Andrey Albershteyn,
linux-xfs, fsverity, linux-fsdevel, ebiggers, linux-ext4,
linux-f2fs-devel, linux-btrfs, linux-unionfs, djwong, david
In-Reply-To: <ahVzkf8JoKP-kSC2@nidhogg.toxiclabs.cc>
On Tue, May 26, 2026 at 12:19:43PM +0200, Carlos Maiolino wrote:
> On Fri, May 22, 2026 at 02:07:57PM +0200, Christoph Hellwig wrote:
> > On Fri, May 22, 2026 at 12:03:20PM +0200, Christian Brauner wrote:
> > > > I was expecting this to come through xfs tree too if Eric and Christian
> > > > agree.
> > >
> > > You may take it through the xfs tree if there are no conflicts with
> > > vfs-7.2.iomap. If there are I want to add the iomap changes into
> > > vfs-7.2.iomap that you can pull in.
> >
> > Merging the iomap bits through the iomap branch might make sense, given
> > that iomap usually tends to see quite a bit of activity.
> >
>
> That sounds good to me. If you want to go ahead and pull in the iomap
> bits, do so, and give me a heads up when you do it so I'll pull your
> branch locally.
Great, can the series please be resent based on current vfs-7.2.iomap
then please? Because the iomap changes in this series don't apply
cleanly on vfs-7.2.iomap so we already have merge conflicts...
^ permalink raw reply
* Re: [PATCH 2/8] ext4: convert mballoc KUnit test to sget_fc()
From: Christian Brauner @ 2026-05-28 12:02 UTC (permalink / raw)
To: Theodore Tso
Cc: linux-fsdevel, Andreas Dilger, Jan Kara, Ritesh Harjani (IBM),
linux-ext4, linux-cifs, Alexander Viro
In-Reply-To: <ny6ggedljk3celsnnaaczpehmgll6hqrglqc44ku53cmxrclx5@w4qby54x6mff>
On Tue, May 26, 2026 at 07:47:27PM -0500, Theodore Ts'o wrote:
> On Tue, May 26, 2026 at 05:09:04PM +0200, Christian Brauner wrote:
> > Add a no-op mbt_init_fs_context() so fs_context_for_mount() has
> > something to call on the fake fs_type....
>
> I was trying to figure out what needed to be in an init_fs_context()
> functrion, and I came accross this in
> Documentation/filesystems/mount_api.rst:
>
> const struct fs_context_operations *ops
>
> These are operations that can be done on a filesystem context (see
> below). This must be set by the ->init_fs_context() file_system_type
> operation. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> So is it safe to just have an init_fs_context() function which doesn't
> do this?
>
> > +static int mbt_init_fs_context(struct fs_context *fc)
> > +{
> > + return 0;
> > +}
> > +
>
> I see in fs/fs_context.c that in some places the code protects against
> a NULL ops pointer:
>
> if (fc->need_free && fc->ops && fc->ops->free)
> fc->ops->free(fc);
>
> But in other places, it doesn't and we'll end up derefrencing a null
> pointer:
>
> if (fc->ops->parse_param) {
> ret = fc->ops->parse_param(fc, param);
>
> ....
>
> So it's unclear to me --- when is it safe (and not safe) to not bother
> to fill in the ops pointer?
Hey Ted!
In these two cases it's fine. Because you're just using the allocation
and deallocation functions to get a fs_context that's basically just an
empty vessel to get at a superblock via sget_fc() but you're not really
doing anything with it.
IOW, you can never end up in callchains that cause issues.
^ permalink raw reply
* Re: [PATCH 14/17] fs/namespace: use __getname() to allocate mntpath buffer
From: Christian Brauner @ 2026-05-28 11:54 UTC (permalink / raw)
To: Mike Rapoport
Cc: Jan Kara, Jan Kara, Mark Fasheh, Joel Becker, Joseph Qi,
Ryusuke Konishi, Viacheslav Dubeyko, Trond Myklebust,
Anna Schumaker, Chuck Lever, Jeff Layton, NeilBrown,
Olga Kornievskaia, Dai Ngo, Tom Talpey, Alexander Viro,
Dave Kleikamp, Theodore Ts'o, Miklos Szeredi,
Andreas Hindborg, Breno Leitao, Kees Cook, Tigran A. Aivazian,
linux-kernel, linux-fsdevel, ocfs2-devel, linux-nilfs, linux-nfs,
jfs-discussion, linux-ext4, linux-mm
In-Reply-To: <ahVisehwQGXEoM0g@kernel.org>
On Tue, May 26, 2026 at 12:06:57PM +0300, Mike Rapoport wrote:
> On Mon, May 25, 2026 at 06:22:13PM +0200, Jan Kara wrote:
> > On Sat 23-05-26 20:54:26, Mike Rapoport (Microsoft) wrote:
> > > mnt_warn_timestamp_expiry() allocates memory for a path with
> > > __get_free_page() although there is a dedicated helper for allocation of
> > > file paths: __getname().
> > >
> > > Replace __get_free_page() for allocation of a path buffer with __getname().
> > >
> > > Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> > > ---
> > > fs/namespace.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/fs/namespace.c b/fs/namespace.c
> > > index fe919abd2f01..2ed9cd846a81 100644
> > > --- a/fs/namespace.c
> > > +++ b/fs/namespace.c
> > > @@ -3303,7 +3303,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint,
> > > (ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
> > > char *buf, *mntpath;
> > >
> > > - buf = (char *)__get_free_page(GFP_KERNEL);
> > > + buf = __getname();
> >
> > Fair but d_path() below should then get PATH_MAX and not PAGE_SIZE.
>
> Ack.
>
> > > if (buf)
> > > mntpath = d_path(mountpoint, buf, PAGE_SIZE);
> > > else
> > > @@ -3319,7 +3319,7 @@ static void mnt_warn_timestamp_expiry(const struct path *mountpoint,
> > >
> > > sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
> > > if (buf)
> > > - free_page((unsigned long)buf);
> > > + __putname(buf);
> >
> > And __putname() is fine with NULL so no need for the if (buf) check here.
>
> Will fix.
I've folded this myself.
^ permalink raw reply
* Re: [PATCH] ext4: Remove mention of PageWriteback
From: Jan Kara @ 2026-05-28 11:41 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: Theodore Ts'o, Andreas Dilger, Baokun Li, Jan Kara,
Ojaswin Mujoo, Ritesh Harjani (IBM), Zhang Yi, linux-ext4,
linux-kernel
In-Reply-To: <20260526190805.341676-1-willy@infradead.org>
On Tue 26-05-26 20:08:02, Matthew Wilcox (Oracle) wrote:
> Update a comment to refer to the concept of writeback instead of the
> (now obsolete) detail of how it's implemented.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/page-io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
> index dc82e7b57e75..bc674aa4a656 100644
> --- a/fs/ext4/page-io.c
> +++ b/fs/ext4/page-io.c
> @@ -168,7 +168,7 @@ static void ext4_release_io_end(ext4_io_end_t *io_end)
> * written. On IO failure, check if journal abort is needed. Note that
> * we are protected from truncate touching same part of extent tree by the
> * fact that truncate code waits for all DIO to finish (thus exclusion from
> - * direct IO is achieved) and also waits for PageWriteback bits. Thus we
> + * direct IO is achieved) and also waits for writeback to complete. Thus we
> * cannot get to ext4_ext_truncate() before all IOs overlapping that range are
> * completed (happens from ext4_free_ioend()).
> */
> --
> 2.47.3
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply
* Re: [PATCH 0/8] super: retire sget(), convert iterators to RCU
From: Jan Kara @ 2026-05-28 11:18 UTC (permalink / raw)
To: Christian Brauner
Cc: linux-fsdevel, Theodore Ts'o, Andreas Dilger, Jan Kara,
Ritesh Harjani (IBM), linux-ext4, linux-cifs, Alexander Viro
In-Reply-To: <20260526-work-sget-v1-0-263f7025cedd@kernel.org>
On Tue 26-05-26 17:09:02, Christian Brauner wrote:
> * retire sget(): CIFS plus the two ext4 KUnit tests (extents-test,
> mballoc-test) were the last in-tree callers, and all three convert
> cleanly to sget_fc(). That lets sget() and its prototype come out,
> taking ~60 lines that only existed to be kept in lockstep with
> sget_fc() on every publish-path change.
This is definitely a good cleanup!
> * Walk @super_blocks and @type->fs_supers under RCU, pinned by
> refcount_inc_not_zero(&sb->s_count). iterate_supers(),
> iterate_supers_type(), user_get_super(), do_emergency_remount(),
> filesystems_freeze() and filesystems_thaw() no longer hold sb_lock
> across the cursor advance.
>
> The conversion goes in four small steps. Drop sb_lock from
> setup_bdev_super(): the {s_bdev_file, s_bdev, s_bdi,
> SB_I_STABLE_WRITES} tuple is publication of immutable state, and
> SB_BORN already gates every reader via super_wake()'s
> smp_store_release paired with super_flags()'s smp_load_acquire. Then
> convert sb->s_count to refcount_t -- mechanical, every increment is
> still under sb_lock. Then switch the write-side list/hlist ops to
> their _rcu variants; @super_blocks gets list_bidir_del_rcu() so the
> reverse-walking iterators (filesystems_freeze, do_emergency_remount)
> keep a valid ->prev on the unlinked entry, matching the canonical
> pattern in kernel/nstree.c. Finally, convert the iterators themselves:
> cursor advance via READ_ONCE / rcu_dereference, with the previous
> entry kept pinned via its s_count across the rcu_read_unlock ->
> callback -> rcu_read_lock cycle.
So I guess the motivation for getting rid of sb_lock is some contention on
it you can observe? When exactly? It would be nice to mention the
motivation as a justification for the additional complexity...
Honza
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
> ---
> Christian Brauner (8):
> ext4: convert extents KUnit test to sget_fc()
> ext4: convert mballoc KUnit test to sget_fc()
> smb: client: convert cifs_smb3_do_mount() to sget_fc()
> fs: retire sget()
> super: drop sb_lock from setup_bdev_super() tuple publication
> super: convert sb->s_count to refcount_t
> super: switch list manipulation to _rcu primitives
> super: convert iterators to RCU readers + refcount_inc_not_zero
>
> fs/btrfs/super.c | 2 +-
> fs/ext4/extents-test.c | 22 +++++-
> fs/ext4/mballoc-test.c | 17 ++++-
> fs/smb/client/cifsfs.c | 43 ++++++-----
> fs/smb/client/cifsfs.h | 3 +-
> fs/smb/client/cifsproto.h | 3 +-
> fs/smb/client/connect.c | 5 +-
> fs/smb/client/fs_context.c | 2 +-
> fs/super.c | 167 ++++++++++++++---------------------------
> include/linux/fs.h | 4 -
> include/linux/fs/super_types.h | 3 +-
> 11 files changed, 127 insertions(+), 144 deletions(-)
> ---
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> change-id: 20260526-work-sget-6bc80b96cba5
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply
* [PATCH] ext4: fix quota accounting WARN in bigalloc punch hole
From: Qiliang Yuan @ 2026-05-28 10:21 UTC (permalink / raw)
To: Theodore Ts'o, Andreas Dilger, Baokun Li, Jan Kara,
Ojaswin Mujoo, Ritesh Harjani (IBM), Zhang Yi
Cc: linux-ext4, linux-kernel, Zijing Yin, Qiliang Yuan
When doing direct I/O write on a bigalloc filesystem, the allocated
extent might not cover entire clusters at its boundaries, leaving
delayed blocks in those boundary clusters. In ext4_es_insert_extent(),
__revise_pending() inserts new pending reservations for those boundary
clusters, and the return value (pending=true) was added to resv_used,
causing ext4_da_update_reserve_space() to incorrectly release the
quota reservations for those boundary clusters.
Later when PUNCH_HOLE removes the DIO-allocated blocks, the
extent removal path detects the pending reservation via
ext4_is_pending() and calls ext4_rereserve_cluster(). This tries
to reclaim quota from dq_dqb.dqb_curspace back to dqb_rsvspace,
but since the quota was already incorrectly released, dqb_curspace
is insufficient, triggering:
WARNING at dquot_reclaim_space_nodirty+0x77c/0x8c0
The subsequent delalloc writeback then fires a second WARN from
dquot_claim_space_nodirty() for the same reason: dqb_rsvspace was
depleted by the earlier incorrect release.
__es_remove_extent() -> get_rsvd() already correctly excludes
boundary clusters that still contain delayed blocks from resv_used.
Adding pending to resv_used double-counts those boundary clusters,
erroneously releasing reservations that are still needed.
Remove the pending variable and the resv_used += pending addition.
Fixes: c543e2429640 ("ext4: update delalloc data reserve spcae in ext4_es_insert_extent()")
Reported-by: Zijing Yin <yzjaurora@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221570
Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
---
fs/ext4/extents_status.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 6e4a191e82191..fefe0bb8ac4d1 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -909,7 +909,7 @@ void ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
struct extent_status newes;
ext4_lblk_t end = lblk + len - 1;
int err1 = 0, err2 = 0, err3 = 0;
- int resv_used = 0, pending = 0;
+ int resv_used = 0;
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
struct extent_status *es1 = NULL;
struct extent_status *es2 = NULL;
@@ -977,7 +977,6 @@ void ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
__free_pending(pr);
pr = NULL;
}
- pending = err3;
}
ext4_es_inc_seq(inode);
error:
@@ -998,7 +997,6 @@ void ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk,
* any previously delayed allocated clusters instead of claim them
* again.
*/
- resv_used += pending;
if (resv_used)
ext4_da_update_reserve_space(inode, resv_used,
delalloc_reserve_used);
---
base-commit: eb3f4b7426cfd2b79d65b7d37155480b32259a11
change-id: 20260528-fix-ext4-bigalloc-punch-hole-quota-v2-2adca315d1ba
Best regards,
--
Qiliang Yuan <realwujing@gmail.com>
^ permalink raw reply related
* Re: [PATCH v4] ext2: Remove deprecated DAX support
From: Ashwin Gundarapu @ 2026-05-28 8:26 UTC (permalink / raw)
To: kernel test robot; +Cc: jack, oe-kbuild-all, linux-ext4, linux-kernel
In-Reply-To: <202605281203.e91xvDyr-lkp@intel.com>
This indentation warning is from pre-existing code (originally written in 2010) that my patch did not touch. I prefer to keep this patch focused solely on removing deprecated DAX support. A separate cleanup patch can be submitted later if desired.
Regards,
Ashwin Gundarapu
From: kernel test robot <lkp@intel.com>
To: "Ashwin Gundarapu"<linuxuser509@zohomail.in>, "jack"<jack@suse.com>
Cc: <oe-kbuild-all@lists.linux.dev>, "linux-ext4"<linux-ext4@vger.kernel.org>, "linux-kernel"<linux-kernel@vger.kernel.org>
Date: Thu, 28 May 2026 09:46:32 +0530
Subject: Re: [PATCH v4] ext2: Remove deprecated DAX support
> Hi Ashwin,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on jack-fs/for_next]
> [also build test WARNING on linus/master v7.1-rc5 next-20260527]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Ashwin-Gundarapu/ext2-Remove-deprecated-DAX-support/20260524-233631
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
> patch link: https://lore.kernel.org/r/19e5aa07c9b.3a2e576d130187.5289857983023045470%40zohomail.in
> patch subject: [PATCH v4] ext2: Remove deprecated DAX support
> config: arm-randconfig-r071-20260528 (https://download.01.org/0day-ci/archive/20260528/202605281203.e91xvDyr-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> smatch: v0.5.0-9185-gbcc58b9c
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202605281203.e91xvDyr-lkp@intel.com/
>
> smatch warnings:
> fs/ext2/inode.c:1251 ext2_setsize() warn: inconsistent indenting
>
> vim +1251 fs/ext2/inode.c
>
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1236
> 2c27c65ed0696f0 Christoph Hellwig 2010-06-04 1237 static int ext2_setsize(struct inode *inode, loff_t newsize)
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1238 {
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1239 int error;
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1240
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1241 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1242 S_ISLNK(inode->i_mode)))
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1243 return -EINVAL;
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1244 if (ext2_inode_is_fast_symlink(inode))
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1245 return -EINVAL;
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1246 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1247 return -EPERM;
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1248
> 562c72aa57c36b1 Christoph Hellwig 2011-06-24 1249 inode_dio_wait(inode);
> 562c72aa57c36b1 Christoph Hellwig 2011-06-24 1250
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 @1251 error = block_truncate_page(inode->i_mapping,
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1252 newsize, ext2_get_block);
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1253 if (error)
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1254 return error;
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1255
> 70f3bad8c3154ba Jan Kara 2021-04-12 1256 filemap_invalidate_lock(inode->i_mapping);
> 2c27c65ed0696f0 Christoph Hellwig 2010-06-04 1257 truncate_setsize(inode, newsize);
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1258 __ext2_truncate_blocks(inode, newsize);
> 70f3bad8c3154ba Jan Kara 2021-04-12 1259 filemap_invalidate_unlock(inode->i_mapping);
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1260
> 5cdc59fce617a2e Jeff Layton 2023-10-04 1261 inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
> ^1da177e4c3f415 Linus Torvalds 2005-04-16 1262 if (inode_needs_sync(inode)) {
> b0439bbc29f0201 Jan Kara 2026-03-26 1263 mmb_sync(&EXT2_I(inode)->i_metadata_bhs);
> c37650161a53c01 Christoph Hellwig 2010-10-06 1264 sync_inode_metadata(inode, 1);
> ^1da177e4c3f415 Linus Torvalds 2005-04-16 1265 } else {
> ^1da177e4c3f415 Linus Torvalds 2005-04-16 1266 mark_inode_dirty(inode);
> ^1da177e4c3f415 Linus Torvalds 2005-04-16 1267 }
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1268
> 737f2e93b9724a3 Nicholas Piggin 2010-05-27 1269 return 0;
> ^1da177e4c3f415 Linus Torvalds 2005-04-16 1270 }
> ^1da177e4c3f415 Linus Torvalds 2005-04-16 1271
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
>
^ permalink raw reply
* Re: [PATCH v4] ext2: Remove deprecated DAX support
From: kernel test robot @ 2026-05-28 4:16 UTC (permalink / raw)
To: Ashwin Gundarapu, jack; +Cc: oe-kbuild-all, linux-ext4, linux-kernel
In-Reply-To: <19e5aa07c9b.3a2e576d130187.5289857983023045470@zohomail.in>
Hi Ashwin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jack-fs/for_next]
[also build test WARNING on linus/master v7.1-rc5 next-20260527]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ashwin-Gundarapu/ext2-Remove-deprecated-DAX-support/20260524-233631
base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
patch link: https://lore.kernel.org/r/19e5aa07c9b.3a2e576d130187.5289857983023045470%40zohomail.in
patch subject: [PATCH v4] ext2: Remove deprecated DAX support
config: arm-randconfig-r071-20260528 (https://download.01.org/0day-ci/archive/20260528/202605281203.e91xvDyr-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605281203.e91xvDyr-lkp@intel.com/
smatch warnings:
fs/ext2/inode.c:1251 ext2_setsize() warn: inconsistent indenting
vim +1251 fs/ext2/inode.c
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1236
2c27c65ed0696f0 Christoph Hellwig 2010-06-04 1237 static int ext2_setsize(struct inode *inode, loff_t newsize)
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1238 {
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1239 int error;
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1240
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1241 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1242 S_ISLNK(inode->i_mode)))
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1243 return -EINVAL;
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1244 if (ext2_inode_is_fast_symlink(inode))
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1245 return -EINVAL;
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1246 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1247 return -EPERM;
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1248
562c72aa57c36b1 Christoph Hellwig 2011-06-24 1249 inode_dio_wait(inode);
562c72aa57c36b1 Christoph Hellwig 2011-06-24 1250
737f2e93b9724a3 Nicholas Piggin 2010-05-27 @1251 error = block_truncate_page(inode->i_mapping,
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1252 newsize, ext2_get_block);
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1253 if (error)
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1254 return error;
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1255
70f3bad8c3154ba Jan Kara 2021-04-12 1256 filemap_invalidate_lock(inode->i_mapping);
2c27c65ed0696f0 Christoph Hellwig 2010-06-04 1257 truncate_setsize(inode, newsize);
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1258 __ext2_truncate_blocks(inode, newsize);
70f3bad8c3154ba Jan Kara 2021-04-12 1259 filemap_invalidate_unlock(inode->i_mapping);
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1260
5cdc59fce617a2e Jeff Layton 2023-10-04 1261 inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
^1da177e4c3f415 Linus Torvalds 2005-04-16 1262 if (inode_needs_sync(inode)) {
b0439bbc29f0201 Jan Kara 2026-03-26 1263 mmb_sync(&EXT2_I(inode)->i_metadata_bhs);
c37650161a53c01 Christoph Hellwig 2010-10-06 1264 sync_inode_metadata(inode, 1);
^1da177e4c3f415 Linus Torvalds 2005-04-16 1265 } else {
^1da177e4c3f415 Linus Torvalds 2005-04-16 1266 mark_inode_dirty(inode);
^1da177e4c3f415 Linus Torvalds 2005-04-16 1267 }
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1268
737f2e93b9724a3 Nicholas Piggin 2010-05-27 1269 return 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 1270 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 1271
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* [PATCH v6 11/11] fstests: test UUID consistency for clones with metadata_uuid
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Btrfs and xfs uses the metadata_uuid superblock feature to change the
on-disk UUID without rewriting every block header. This patch adds a
sanity check to ensure UUID consistency when a filesystem with
metadata_uuid enabled is cloned.
Signed-off-by: Anand Jain <asj@kernel.org>
---
tests/generic/806 | 84 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/806.out | 19 ++++++++++
2 files changed, 103 insertions(+)
create mode 100644 tests/generic/806
create mode 100644 tests/generic/806.out
diff --git a/tests/generic/806 b/tests/generic/806
new file mode 100644
index 000000000000..801671fb9ce9
--- /dev/null
+++ b/tests/generic/806
@@ -0,0 +1,84 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Anand Jain <asj@kernel.org>. All Rights Reserved.
+#
+# FS QA Test 806
+#
+# Verify that the cloned filesystem UUID remains consistent, even when the
+# `metadata_uuid` feature is enabled.
+#
+
+. ./common/preamble
+. ./common/filter
+
+_begin_fstest auto quick mount clone
+
+_require_test
+_require_block_device $TEST_DEV
+_require_loop
+
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+ umount $mnt1 $mnt2 2>/dev/null
+ _loop_image_destroy "${devs[@]}" 2> /dev/null
+}
+
+filter_pool()
+{
+ sed -e "s|${devs[0]}|DEV1|g" -e "s|${mnt1}|MNT1|g" \
+ -e "s|${devs[1]}|DEV2|g" -e "s|${mnt2}|MNT2|g" | _filter_spaces
+}
+
+# Collect and print device resolution properties across user-space tools
+print_info()
+{
+ local mntpt=$1
+ local tgt=$(findmnt -no SOURCE $mntpt)
+ local fsuuid=$(blkid -s UUID -o value $tgt)
+
+ echo "mntpt=$mntpt tgt=$tgt fsuuid=$fsuuid" >> $seqres.full
+ echo
+ findmnt -o SOURCE,TARGET,UUID "$tgt" | tail -n +2 | \
+ sed -e "s/${fsuuid}/FSUUID/g" | filter_pool
+ awk -v dev="$tgt" '$1 == dev { print $1, $2 }' /proc/self/mounts | \
+ filter_pool
+ df --all --output=source,target "$tgt" | tail -n +2 | filter_pool
+}
+
+# Create base loop device and its clone, applying the metadata_uuid tuning
+# callback to the base filesystem before the copy occurs.
+devs=()
+_loop_image_create_clone devs _change_metadata_uuid
+mkdir -p $TEST_DIR/$seq
+mnt1=$TEST_DIR/$seq/mnt1
+mnt2=$TEST_DIR/$seq/mnt2
+mkdir -p $mnt1
+mkdir -p $mnt2
+
+# Mount both clone and baseline
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+
+print_info $mnt1
+print_info $mnt2
+
+# Cycle mounts and reverse the initialization order to ensure UUID tracking
+# doesn't mismatch or flip when metadata_uuid optimization is active.
+echo
+echo "**** mount cycle ****"
+_unmount $mnt1
+_unmount $mnt2
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+
+print_info $mnt1
+print_info $mnt2
+
+status=0
+exit
diff --git a/tests/generic/806.out b/tests/generic/806.out
new file mode 100644
index 000000000000..7315e791ba51
--- /dev/null
+++ b/tests/generic/806.out
@@ -0,0 +1,19 @@
+QA output created by 806
+
+DEV1 MNT1 FSUUID
+DEV1 MNT1
+DEV1 MNT1
+
+DEV2 MNT2 FSUUID
+DEV2 MNT2
+DEV2 MNT2
+
+**** mount cycle ****
+
+DEV1 MNT1 FSUUID
+DEV1 MNT1
+DEV1 MNT1
+
+DEV2 MNT2 FSUUID
+DEV2 MNT2
+DEV2 MNT2
--
2.43.0
^ permalink raw reply related
* [PATCH v6 10/11] fstests: add _change_metadata_uuid helper
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
_change_metadata_uuid changes the UUID of the golden filesystem before it
is cloned.
Signed-off-by: Anand Jain <asj@kernel.org>
---
common/rc | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/common/rc b/common/rc
index 5446552aed92..79be51e4da31 100644
--- a/common/rc
+++ b/common/rc
@@ -1537,6 +1537,29 @@ _scratch_resvblks()
esac
}
+# Change the metadata UUID of the given device to a newly generated one.
+# Args:
+# $1: Block device path to modify.
+_change_metadata_uuid()
+{
+ local temp_mnt=$TEST_DIR/${seq}_mnt
+ local dev=$1
+
+ case $FSTYP in
+ xfs)
+ _require_command "$XFS_ADMIN_PROG" "xfs_admin"
+ $XFS_ADMIN_PROG -U generate $dev >> $seqres.full
+ ;;
+ btrfs)
+ _require_command "$BTRFS_TUNE_PROG" "btrfstune"
+ $BTRFS_TUNE_PROG -m $dev
+ ;;
+ *)
+ _notrun "Require filesystem with metadata_uuid feature"
+ ;;
+ esac
+}
+
# Create a small loop image, run an optional tuning function ($2) on it,
# clone it, and attach both to loop devices, returned in ($1).
# Args:
--
2.43.0
^ permalink raw reply related
* [PATCH v6 09/11] fstests: verify exportfs file handles on cloned filesystems
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Ensure that exportfs can correctly decode file handles on a cloned
filesystem across a mount cycle, by file handles generated on a
cloned device remain valid after mount cycle.
Signed-off-by: Anand Jain <asj@kernel.org>
---
tests/generic/805 | 80 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/805.out | 2 ++
2 files changed, 82 insertions(+)
create mode 100644 tests/generic/805
create mode 100644 tests/generic/805.out
diff --git a/tests/generic/805 b/tests/generic/805
new file mode 100644
index 000000000000..5827eee039df
--- /dev/null
+++ b/tests/generic/805
@@ -0,0 +1,80 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Anand Jain <asj@kernel.org>. All Rights Reserved.
+#
+# FS QA Test No. 805
+# Verify that file handles encoded on a cloned filesystem remain valid and
+# resolvable via open_by_handle across a mount cycle and mount order swap.
+
+. ./common/preamble
+
+_begin_fstest auto quick exportfs clone
+
+_require_test
+_require_block_device $TEST_DEV
+_require_exportfs
+_require_loop
+_require_test_program "open_by_handle"
+
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+ _unmount $mnt1 2>/dev/null
+ _unmount $mnt2 2>/dev/null
+ _loop_image_destroy "${devs[@]}" 2> /dev/null
+}
+
+# Create test dir and test files, encode file handles and store to tmp file
+create_test_files()
+{
+ rm -rf $testdir
+ mkdir -p $testdir
+ $here/src/open_by_handle -cwp -o $tmp.handles_file $testdir $NUMFILES
+}
+
+# Attempt to read and decode the saved file handles on the targeted mount point.
+test_file_handles()
+{
+ local opt=$1
+ local when=$2
+
+ echo test_file_handles after $when
+ $here/src/open_by_handle $opt -i $tmp.handles_file $mnt2 $NUMFILES
+}
+
+# Setup base loop device and its clone
+devs=()
+_loop_image_create_clone devs
+mkdir -p $TEST_DIR/$seq
+mnt1=$TEST_DIR/$seq/mnt1
+mnt2=$TEST_DIR/$seq/mnt2
+mkdir -p $mnt1
+mkdir -p $mnt2
+
+# Mount both identical UUID filesystems simultaneously
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+
+NUMFILES=1
+testdir=$mnt2/testdir
+
+# Decode file handles of files/dir after cycle mount
+create_test_files
+
+# Cycle mounts and reverse initialization sequence to check if
+# file handle lookups are okay
+_unmount $mnt1
+_unmount $mnt2
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+
+# Verify file handles can still be resolved post-mount-cycle
+test_file_handles -rp "cycle mount"
+
+status=0
+exit
diff --git a/tests/generic/805.out b/tests/generic/805.out
new file mode 100644
index 000000000000..29b11ec77ffb
--- /dev/null
+++ b/tests/generic/805.out
@@ -0,0 +1,2 @@
+QA output created by 805
+test_file_handles after cycle mount
--
2.43.0
^ permalink raw reply related
* [PATCH v6 08/11] fstests: verify IMA isolation on cloned filesystems
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Add testcase to verify IMA measurement isolation when multiple devices
share the same FSUUID.
Signed-off-by: Anand Jain <asj@kernel.org>
---
tests/generic/804 | 108 ++++++++++++++++++++++++++++++++++++++++++
tests/generic/804.out | 10 ++++
2 files changed, 118 insertions(+)
create mode 100644 tests/generic/804
create mode 100644 tests/generic/804.out
diff --git a/tests/generic/804 b/tests/generic/804
new file mode 100644
index 000000000000..31ae77a2f461
--- /dev/null
+++ b/tests/generic/804
@@ -0,0 +1,108 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Anand Jain <asj@kernel.org>. All Rights Reserved.
+#
+# FS QA Test 804
+# Verify IMA isolation on cloned filesystems:
+# . Mount two devices sharing the same FSUUID (cloned).
+# . Apply an IMA policy to measure files based on that FSUUID.
+# . Create unique files on each mount point to trigger measurements.
+# . Confirm the IMA log correctly attributes events to the respective mounts.
+
+. ./common/preamble
+. ./common/filter
+
+_begin_fstest auto quick clone
+
+_require_test
+_require_block_device $TEST_DEV
+_require_loop
+
+[ "$FSTYP" = "btrfs" ] && _fixed_by_kernel_commit xxxxxxxxxxxx \
+ "btrfs: use on-disk uuid for s_uuid in temp_fsid mounts"
+[ "$FSTYP" = "btrfs" ] && _fixed_by_kernel_commit xxxxxxxxxxxx \
+ "btrfs: derive f_fsid from on-disk fsuuid and dev_t"
+
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+ _unmount $mnt1 2>/dev/null
+ _unmount $mnt2 2>/dev/null
+ _loop_image_destroy "${devs[@]}" 2> /dev/null
+}
+
+# Normalize device names and mount points
+filter_pool()
+{
+ sed -e "s|${devs[0]}|DEV1|g" -e "s|$mnt1|MNT1|g" \
+ -e "s|${devs[1]}|DEV2|g" -e "s|$mnt2|MNT2|g" | _filter_spaces
+}
+
+# Core helper to set IMA policy and check measurement logs
+do_ima()
+{
+ local ima_policy="/sys/kernel/security/ima/policy"
+ local ima_log="/sys/kernel/security/ima/ascii_runtime_measurements"
+ local fsuuid
+ local mnt=$1
+ local enable=$2
+
+ # Since the in-memory IMA audit log is only cleared upon reboot,
+ # use unique random filenames to avoid log collisions.
+ local foofile=$(mktemp --dry-run foobar_XXXXX)
+
+ echo $mnt $enable | filter_pool
+
+ [ -w "$ima_policy" ] || _notrun "IMA policy not writable"
+
+ fsuuid=$(blkid -s UUID -o value ${devs[0]})
+
+ # Load IMA policy to measure file access specifically for this
+ # filesystem UUID.
+ if [[ $enable -eq 1 ]]; then
+ echo "measure func=FILE_CHECK fsuuid=$fsuuid" > "$ima_policy" || \
+ _notrun "Policy rejected"
+ fi
+
+ # Create a file to trigger measurement and verify its entry in
+ # the IMA log.
+ echo "test_data" > $mnt/$foofile
+
+ # IMA log extract
+ grep $foofile "$ima_log" | awk '{ print $5 }' | filter_pool | \
+ sed "s/$foofile/FOOBAR_FILE/"
+
+ echo "dbg: $mnt $fsuuid $foofile" >> $seqres.full
+ cat $ima_log | tail -1 >> $seqres.full
+ echo >> $seqres.full
+}
+
+# Initialize loop base and cloned instances
+devs=()
+_loop_image_create_clone devs
+mnt1=$TEST_DIR/$seq/mnt1
+mnt2=$TEST_DIR/$seq/mnt2
+mkdir -p $mnt1
+mkdir -p $mnt2
+
+# Concurrently mount both clones
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+
+# IMA response on baseline and clone configuration
+do_ima $mnt1 1
+do_ima $mnt2 0
+
+# Cycle mount on the second device.
+echo mount cycle
+_unmount $mnt2
+_mount $mount_opts ${devs[1]} $mnt2 || _fail "Failed to mount dev2"
+
+do_ima $mnt1 0
+do_ima $mnt2 0
+
+status=0
+exit
diff --git a/tests/generic/804.out b/tests/generic/804.out
new file mode 100644
index 000000000000..9804181d6c17
--- /dev/null
+++ b/tests/generic/804.out
@@ -0,0 +1,10 @@
+QA output created by 804
+MNT1 1
+MNT1/FOOBAR_FILE
+MNT2 0
+MNT2/FOOBAR_FILE
+mount cycle
+MNT1 0
+MNT1/FOOBAR_FILE
+MNT2 0
+MNT2/FOOBAR_FILE
--
2.43.0
^ permalink raw reply related
* [PATCH v6 07/11] fstests: verify libblkid resolution of duplicate UUIDs
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Verify how findmnt, df (libblkid) resolve device paths when multiple
block devices share the same FSUUID.
Signed-off-by: Anand Jain <asj@kernel.org>
---
tests/generic/803 | 84 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/803.out | 19 ++++++++++
2 files changed, 103 insertions(+)
create mode 100644 tests/generic/803
create mode 100644 tests/generic/803.out
diff --git a/tests/generic/803 b/tests/generic/803
new file mode 100644
index 000000000000..b304a2743604
--- /dev/null
+++ b/tests/generic/803
@@ -0,0 +1,84 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Anand Jain <asj@kernel.org>. All Rights Reserved.
+#
+# FS QA Test 803
+# Verify how libblkid resolve devices when multiple devices sharing the
+# same FSUUID.
+
+. ./common/preamble
+. ./common/filter
+
+_begin_fstest auto quick mount clone
+
+_require_test
+_require_block_device $TEST_DEV
+_require_loop
+
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+ umount $mnt1 $mnt2 2>/dev/null
+ _loop_image_destroy "${devs[@]}" 2> /dev/null
+}
+
+# Normalize pool devices and mount points names
+filter_pool()
+{
+ sed -e "s|${devs[0]}|DEV1|g" -e "s|${mnt1}|MNT1|g" \
+ -e "s|${devs[1]}|DEV2|g" -e "s|${mnt2}|MNT2|g" | _filter_spaces
+}
+
+# Collect and print device tracking info from findmnt, /proc/mounts, and df.
+# This checks whether user-space tools get confused or remain accurate when
+# resolving a duplicate/cloned filesystem UUID.
+print_info()
+{
+ local mntpt=$1
+ local tgt=$(findmnt -no SOURCE $mntpt)
+ local fsuuid=$(blkid -s UUID -o value $tgt)
+
+ echo "mntpt=$mntpt tgt=$tgt fsuuid=$fsuuid" >> $seqres.full
+ echo
+ findmnt -o SOURCE,TARGET,UUID "$tgt" | tail -n +2 | \
+ sed -e "s/${fsuuid}/FSUUID/g" | filter_pool
+ awk -v dev="$tgt" '$1 == dev { print $1, $2 }' /proc/self/mounts | \
+ filter_pool
+ df --all --output=source,target "$tgt" | tail -n +2 | filter_pool
+}
+
+# Setup base loop device and its clone
+devs=()
+_loop_image_create_clone devs
+mkdir -p $TEST_DIR/$seq
+mnt1=$TEST_DIR/$seq/mnt1
+mnt2=$TEST_DIR/$seq/mnt2
+mkdir -p $mnt1
+mkdir -p $mnt2
+
+# Mount both identical UUID filesystems simultaneously
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+
+print_info $mnt1
+print_info $mnt2
+
+# Cycle mounts and reverse the initialization order to see if libblkid / findmnt
+# resolution changes based on mount order.
+echo
+echo "**** mount cycle ****"
+_unmount $mnt1
+_unmount $mnt2
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+
+print_info $mnt1
+print_info $mnt2
+
+status=0
+exit
diff --git a/tests/generic/803.out b/tests/generic/803.out
new file mode 100644
index 000000000000..20a1cb36a213
--- /dev/null
+++ b/tests/generic/803.out
@@ -0,0 +1,19 @@
+QA output created by 803
+
+DEV1 MNT1 FSUUID
+DEV1 MNT1
+DEV1 MNT1
+
+DEV2 MNT2 FSUUID
+DEV2 MNT2
+DEV2 MNT2
+
+**** mount cycle ****
+
+DEV1 MNT1 FSUUID
+DEV1 MNT1
+DEV1 MNT1
+
+DEV2 MNT2 FSUUID
+DEV2 MNT2
+DEV2 MNT2
--
2.43.0
^ permalink raw reply related
* [PATCH v6 06/11] fstests: verify f_fsid for cloned filesystems
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Verify that the cloned filesystem provides an f_fsid that is persistent
across mount cycles, yet unique from the original filesystem's f_fsid.
Signed-off-by: Anand Jain <asj@kernel.org>
---
tests/generic/802 | 67 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/802.out | 7 +++++
2 files changed, 74 insertions(+)
create mode 100644 tests/generic/802
create mode 100644 tests/generic/802.out
diff --git a/tests/generic/802 b/tests/generic/802
new file mode 100644
index 000000000000..653e74e11b53
--- /dev/null
+++ b/tests/generic/802
@@ -0,0 +1,67 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Anand Jain <asj@kernel.org>. All Rights Reserved.
+#
+# FS QA Test 802
+# Verify f_fsid and s_uuid of cloned filesystems across mount cycle.
+
+. ./common/preamble
+
+_begin_fstest auto quick mount clone
+
+_require_test
+_require_block_device $TEST_DEV
+_require_loop
+
+[ "$FSTYP" = "btrfs" ] && _fixed_by_kernel_commit xxxxxxxxxxxx \
+ "btrfs: use on-disk uuid for s_uuid in temp_fsid mounts"
+[ "$FSTYP" = "btrfs" ] && _fixed_by_kernel_commit xxxxxxxxxxxx \
+ "btrfs: derive f_fsid from on-disk fsuuid and dev_t"
+
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+ umount $mnt1 $mnt2 2>/dev/null
+ _loop_image_destroy "${devs[@]}" 2> /dev/null
+}
+
+# Setup base loop device and its clone
+devs=()
+_loop_image_create_clone devs
+mkdir -p $TEST_DIR/$seq
+mnt1=$TEST_DIR/$seq/mnt1
+mnt2=$TEST_DIR/$seq/mnt2
+mkdir -p $mnt1
+mkdir -p $mnt2
+
+# Mount both filesystems simultaneously using mandatory clone mount options
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+
+# Capture baseline filesystem IDs for comparison
+fsid_scratch=$(stat -f -c "%i" $mnt1)
+fsid_clone=$(stat -f -c "%i" $mnt2)
+
+echo "**** fsid initially ****"
+echo $fsid_scratch | sed -e "s/$fsid_scratch/FSID_SCRATCH/g"
+echo $fsid_clone | sed -e "s/$fsid_clone/FSID_CLONE/g"
+
+# Verify that the fsids remain stable after a mount cycle, even when the
+# mount order is reversed.
+echo "**** fsid after mount cycle ****"
+_unmount $mnt1
+_unmount $mnt2
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+
+# Compare post mount-cycle values against the baseline
+stat -f -c "%i" $mnt1 | sed -e "s/$fsid_scratch/FSID_SCRATCH/g"
+stat -f -c "%i" $mnt2 | sed -e "s/$fsid_clone/FSID_CLONE/g"
+
+status=0
+exit
diff --git a/tests/generic/802.out b/tests/generic/802.out
new file mode 100644
index 000000000000..d1e008f122bb
--- /dev/null
+++ b/tests/generic/802.out
@@ -0,0 +1,7 @@
+QA output created by 802
+**** fsid initially ****
+FSID_SCRATCH
+FSID_CLONE
+**** fsid after mount cycle ****
+FSID_SCRATCH
+FSID_CLONE
--
2.43.0
^ permalink raw reply related
* [PATCH v6 05/11] fstests: verify fanotify isolation on cloned filesystems
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Verify that fanotify events are correctly routed to the appropriate
watcher when cloned filesystems are mounted.
Helps verify kernel's event notification distinguishes between devices
sharing the same FSID/UUID.
Signed-off-by: Anand Jain <asj@kernel.org>
---
tests/generic/801 | 135 ++++++++++++++++++++++++++++++++++++++++++
tests/generic/801.out | 7 +++
2 files changed, 142 insertions(+)
create mode 100644 tests/generic/801
create mode 100644 tests/generic/801.out
diff --git a/tests/generic/801 b/tests/generic/801
new file mode 100644
index 000000000000..3bfb87d41922
--- /dev/null
+++ b/tests/generic/801
@@ -0,0 +1,135 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Anand Jain <asj@kernel.org>. All Rights Reserved.
+#
+# FS QA Test 801
+# Verify fanotify FID functionality on cloned filesystems by setting up
+# watchers and making sure notifications are in the correct logs files.
+
+. ./common/preamble
+
+_begin_fstest auto quick mount clone
+
+_require_test
+_require_block_device $TEST_DEV
+_require_loop
+_require_command "$FSNOTIFYWAIT_PROG" fsnotifywait
+_require_unique_f_fsid
+
+_cleanup()
+{
+ cd /
+ [[ -n $pid1 ]] && { kill -TERM "$pid1" 2> /dev/null; wait $pid1; }
+ [[ -n $pid2 ]] && { kill -TERM "$pid2" 2> /dev/null; wait $pid2; }
+
+ if [ "$semanage_added" = "yes" ]; then
+ semanage permissive -d unconfined_t >/dev/null 2>&1 || true
+ fi
+
+ umount $mnt1 $mnt2 2>/dev/null
+ _loop_image_destroy "${devs[@]}" 2> /dev/null
+ rm -r -f $tmp.*
+}
+
+# Run fsnotifywait in unbuffered mode to watch filesystem-wide create events
+monitor_fanotify()
+{
+ local mmnt=$1
+ exec stdbuf -oL $FSNOTIFYWAIT_PROG -m -F -S -e create "$mmnt" 2>&1
+}
+
+# Transform f_fsid into the hi.lo format used in fanotify FID logs
+fsid_to_fid_parts()
+{
+ local fsid=$1
+ # Pad to 16 hex chars (64-bit), then split into two 32-bit halves
+ local padded=$(printf '%016x' "0x${fsid}")
+ local hi=$(printf '%x' "0x${padded:0:8}") # strips leading zeros
+ local lo=$(printf '%x' "0x${padded:8:8}") # strips leading zeros
+ echo "${hi}.${lo}"
+}
+
+# Create base loop device and its clone
+devs=()
+_loop_image_create_clone devs
+mkdir -p $TEST_DIR/$seq
+mnt1=$TEST_DIR/$seq/mnt1
+mnt2=$TEST_DIR/$seq/mnt2
+mkdir -p $mnt1
+mkdir -p $mnt2
+
+# Mount both base and clone filesystems using required clone mount options
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[0]} $mnt1 || \
+ _fail "Failed to mount dev1"
+_mount $(_common_dev_mount_options) $(_clone_mount_option) ${devs[1]} $mnt2 || \
+ _fail "Failed to mount dev2"
+
+# Fetch filesystem IDs to verify the kernel can differentiate between them
+fsid1=$(stat -f -c "%i" $mnt1)
+fsid2=$(stat -f -c "%i" $mnt2)
+
+log1=$tmp.fanotify1
+log2=$tmp.fanotify2
+
+pid1=""
+pid2=""
+echo "Setup FID fanotify watchers on both mnt1 and mnt2"
+
+# Permit unconfined_t domains when SELinux is enforcing to prevent fanotify
+# blockages
+semanage_added="no"
+if [ "$(getenforce 2>/dev/null)" = "Enforcing" ]; then
+ if ! semanage permissive -l | grep -q "unconfined_t"; then
+ semanage permissive -a unconfined_t >/dev/null 2>&1 && semanage_added="yes"
+ fi
+fi
+
+# Start asynchronous fanotify monitors
+( monitor_fanotify "$mnt1" > "$log1" ) &
+pid1=$!
+( monitor_fanotify "$mnt2" > "$log2" ) &
+pid2=$!
+sleep 2
+
+echo "Trigger file creation on mnt1"
+touch $mnt1/file_on_mnt1
+sync
+sleep 1
+
+echo "Trigger file creation on mnt2"
+touch $mnt2/file_on_mnt2
+sync
+sleep 1
+
+echo "Verify fsid in the fanotify"
+kill $pid1 $pid2
+wait $pid1 $pid2 2>/dev/null
+pid1=""
+pid2=""
+
+e_fsid1=$(fsid_to_fid_parts "$fsid1")
+e_fsid2=$(fsid_to_fid_parts "$fsid2")
+
+# Dump debug details to the full log
+echo $fsid1 $e_fsid1 $fsid2 $e_fsid2 >> $seqres.full
+cat $log1 >> $seqres.full
+cat $log2 >> $seqres.full
+
+# Ensure monitor 1 only captured events belonging to mnt 1 and fsid 1
+if grep -qF "$e_fsid1" "$log1" && ! grep -qF "$e_fsid2" "$log1"; then
+ echo "SUCCESS: mnt1 events found"
+else
+ [ ! -s "$log1" ] && echo " - mnt1 received no events."
+ grep -qF "$e_fsid2" "$log1" && echo " - mnt1 received event from mnt2."
+fi
+
+# Ensure monitor 2 only captured events belonging to mnt 2 and fsid 2
+if grep -qF "$e_fsid2" "$log2" && ! grep -qF "$e_fsid1" "$log2"; then
+ echo "SUCCESS: mnt2 events found"
+else
+ [ ! -s "$log2" ] && echo " - mnt2 received no events."
+ grep -qF "$e_fsid1" "$log2" && echo " - mnt2 received event from mnt1."
+fi
+
+status=0
+exit
diff --git a/tests/generic/801.out b/tests/generic/801.out
new file mode 100644
index 000000000000..d7b318d9f27c
--- /dev/null
+++ b/tests/generic/801.out
@@ -0,0 +1,7 @@
+QA output created by 801
+Setup FID fanotify watchers on both mnt1 and mnt2
+Trigger file creation on mnt1
+Trigger file creation on mnt2
+Verify fsid in the fanotify
+SUCCESS: mnt1 events found
+SUCCESS: mnt2 events found
--
2.43.0
^ permalink raw reply related
* [PATCH v6 04/11] fstests: add _require_unique_f_fsid() helper
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Add a helper to check if the target filesystem supports unique f_fsid
tracking across cloned or snapshot instances.
Certain filesystems like XFS, Btrfs, and F2FS ensure unique f_fsid
identifiers per filesystem instance. However, Ext4 derives its f_fsid
directly from its superblock UUID, which leads to identical f_fsid
values on cloned images until the UUID is manually modified by userspace.
Introduce _require_unique_f_fsid() to allow test cases requiring strict
f_fsid uniqueness to skip gracefully on unsupported filesystems.
Signed-off-by: Anand Jain <asj@kernel.org>
---
common/rc | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/common/rc b/common/rc
index 937f478963b4..5446552aed92 100644
--- a/common/rc
+++ b/common/rc
@@ -6314,6 +6314,27 @@ _require_fanotify_ioerrors()
_notrun "$FSTYP does not support fanotify ioerrors"
}
+# Ext4 derives f_fsid from the superblock UUID, meaning clones share the
+# same f_fsid until their UUIDs diverge. Conversely, XFS, Btrfs,
+# and F2FS ensure f_fsid remains unique per filesystem instance (often by
+# deriving it from the UUID and underlying block device.)
+#
+# Across all filesystems, a UUID collision causes libblkid tools to return
+# non-deterministic device mappings. It is ultimately the responsibility
+# of the userspace utility or use-case to enforce uniqueness when a clone
+# diverges. For details, see mailing list thread discussions titled:
+# "ext4: derive f_fsid from block device to avoid collisions".
+_require_unique_f_fsid()
+{
+ # Skip the test if the filesystem does not enforce unique f_fsids
+ # natively. Checking this dynamically requires recreating a clone
+ # layout, so we use a static lookup based on FSTYP.
+ if [ "$FSTYP" == "ext4" ]; then
+ _notrun "Target filesystem ($FSTYP) does not guarantee unique f_fsid on clones."
+ fi
+}
+
+
# Computes a percentage of the available space in a filesystem and
# returns that quantity in MB. The percentage must not contain a percent
# sign ("%").
--
2.43.0
^ permalink raw reply related
* [PATCH v6 03/11] fstests: add FSNOTIFYWAIT_PROG
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Define `FSNOTIFYWAIT_PROG` for an upcoming test case that uses `fsnotifywait`.
Signed-off-by: Anand Jain <asj@kernel.org>
---
common/config | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/config b/common/config
index d5299d5b926f..5661fa0ec310 100644
--- a/common/config
+++ b/common/config
@@ -242,6 +242,7 @@ export BTRFS_MAP_LOGICAL_PROG=$(type -P btrfs-map-logical)
export PARTED_PROG="$(type -P parted)"
export XFS_PROPERTY_PROG="$(type -P xfs_property)"
export FSCRYPTCTL_PROG="$(type -P fscryptctl)"
+export FSNOTIFYWAIT_PROG="$(type -P fsnotifywait)"
# udev wait functions.
#
--
2.43.0
^ permalink raw reply related
* [PATCH v6 02/11] fstests: add _clone_mount_option() helper
From: Anand Jain @ 2026-05-28 4:05 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, linux-ext4, linux-xfs, linux-f2fs-devel, zlang, hch
In-Reply-To: <cover.1779939330.git.asj@kernel.org>
Adds _clone_mount_option() helper function to handle filesystem-specific
requirements for mounting cloned devices. Abstract the need for -o nouuid
on XFS.
Signed-off-by: Anand Jain <asj@kernel.org>
---
common/rc | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/common/rc b/common/rc
index d7e3e0bdfb1e..937f478963b4 100644
--- a/common/rc
+++ b/common/rc
@@ -414,6 +414,23 @@ _scratch_mount_options()
$SCRATCH_DEV $SCRATCH_MNT
}
+# Return filesystem-specific mount options required for mounting clone/snapshot
+# devices.
+_clone_mount_option()
+{
+ local mount_opts=""
+
+ case "$FSTYP" in
+ xfs)
+ # Allow mounting a duplicate filesystem on the same host
+ mount_opts="-o nouuid"
+ ;;
+ *)
+ esac
+
+ echo $mount_opts
+}
+
_supports_filetype()
{
local dir=$1
--
2.43.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox