Re: [PATCH] nilfs2: fix missing continue after -ENOENT in nilfs_ioctl_mark_blocks_dirty()

Deepanshu Kartikey <[email protected]> Mon, 30 Mar 2026 15:10:46 +0530
Newsgroups org.kernel.vger.linux-nilfs,org.kernel.vger.linux-kernel
Message-ID <CADhLXY7CyKubhVgSc1ptjL0H_5A5N=uuWRKWpf7rJbFCxySRCA@mail.gmail.com>
On Fri, Mar 20, 2026 at 11:02 PM Ryusuke Konishi
<[email protected]> wrote:
>
> Thank you, Deepanshu.
>
> On Thu, Mar 19, 2026 at 6:19 PM Deepanshu Kartikey wrote:
> >
> > nilfs_ioctl_mark_blocks_dirty() calls nilfs_bmap_lookup_at_level() to
> > get the current block number of each block descriptor. When the lookup
> > returns -ENOENT, meaning the block does not exist, it sets bd_blocknr
> > to 0 and continues processing.
> >
> > However, if bd_oblocknr is also 0, the subsequent check:
> >
> >   if (bdescs[i].bd_blocknr != bdescs[i].bd_oblocknr)
> >           continue;
> >
> > will not skip the block, and nilfs_bmap_mark() will be called on a
> > non-existent block. This causes nilfs_btree_do_lookup() to return
> > -ENOENT, triggering the WARN_ON(ret == -ENOENT).
> >
> > Fix this by adding a continue statement after setting bd_blocknr to 0
> > when the lookup returns -ENOENT, so that dead blocks are always skipped
> > regardless of the value of bd_oblocknr.
> >
> > Fixes: 7942b919f732 ("nilfs2: ioctl operations")
> > Reported-by: [email protected]
> > Closes: https://syzkaller.appspot.com/bug?extid=98a040252119df0506f8
> > Signed-off-by: Deepanshu Kartikey <[email protected]>
> > ---
> >  fs/nilfs2/ioctl.c | 1 +
> >  1 file changed, 1 insertion(+)
>
> Since this implementation interacts with userland GC, I will check
> whether this is a simple missing 'continue' statement or if it was
> intentional.
> If it is as you pointed out, I will pick it up and send it upstream.
>
> Thanks,
> Ryusuke Konishi
>

gentle ping on this patch. Would like to know the status.
Let me know anything is required from my side

Thanks

Deepanshu