* [PATCH] nilfs2: fix backing_dev_info reference leak
@ 2026-05-07 15:50 Shuangpeng Bai
2026-05-07 21:41 ` Viacheslav Dubeyko
0 siblings, 1 reply; 4+ messages in thread
From: Shuangpeng Bai @ 2026-05-07 15:50 UTC (permalink / raw)
To: Ryusuke Konishi
Cc: Viacheslav Dubeyko, Christian Brauner, linux-nilfs, linux-kernel,
Shuangpeng Bai
setup_bdev_super() already initializes sb->s_bdev and takes a
reference on the block device backing_dev_info when assigning sb->s_bdi.
nilfs_fill_super() takes another reference to the same
backing_dev_info and stores it in sb->s_bdi again. The extra
reference is not paired with a matching bdi_put(), since
generic_shutdown_super() releases sb->s_bdi only once.
Drop the redundant bdi_get() in nilfs_fill_super(). The single
reference taken by setup_bdev_super() is enough and is released
during superblock shutdown.
Fixes: c1e012ea9e83 ("nilfs2: use setup_bdev_super to de-duplicate the mount code")
Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
---
fs/nilfs2/super.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 7aa5ef8606cd..893a504cb80c 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -1070,8 +1070,6 @@ nilfs_fill_super(struct super_block *sb, struct fs_context *fc)
sb->s_time_gran = 1;
sb->s_max_links = NILFS_LINK_MAX;
- sb->s_bdi = bdi_get(sb->s_bdev->bd_disk->bdi);
-
err = load_nilfs(nilfs, sb);
if (err)
goto failed_nilfs;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] nilfs2: fix backing_dev_info reference leak
2026-05-07 15:50 [PATCH] nilfs2: fix backing_dev_info reference leak Shuangpeng Bai
@ 2026-05-07 21:41 ` Viacheslav Dubeyko
2026-05-08 2:05 ` Ryusuke Konishi
0 siblings, 1 reply; 4+ messages in thread
From: Viacheslav Dubeyko @ 2026-05-07 21:41 UTC (permalink / raw)
To: Shuangpeng Bai, Ryusuke Konishi
Cc: Viacheslav Dubeyko, Christian Brauner, linux-nilfs, linux-kernel
On Thu, 2026-05-07 at 11:50 -0400, Shuangpeng Bai wrote:
> setup_bdev_super() already initializes sb->s_bdev and takes a
> reference on the block device backing_dev_info when assigning sb->s_bdi.
>
> nilfs_fill_super() takes another reference to the same
> backing_dev_info and stores it in sb->s_bdi again. The extra
> reference is not paired with a matching bdi_put(), since
> generic_shutdown_super() releases sb->s_bdi only once.
>
> Drop the redundant bdi_get() in nilfs_fill_super(). The single
> reference taken by setup_bdev_super() is enough and is released
> during superblock shutdown.
>
> Fixes: c1e012ea9e83 ("nilfs2: use setup_bdev_super to de-duplicate the mount code")
> Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
> ---
> fs/nilfs2/super.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
> index 7aa5ef8606cd..893a504cb80c 100644
> --- a/fs/nilfs2/super.c
> +++ b/fs/nilfs2/super.c
> @@ -1070,8 +1070,6 @@ nilfs_fill_super(struct super_block *sb, struct fs_context *fc)
> sb->s_time_gran = 1;
> sb->s_max_links = NILFS_LINK_MAX;
>
> - sb->s_bdi = bdi_get(sb->s_bdev->bd_disk->bdi);
> -
> err = load_nilfs(nilfs, sb);
> if (err)
> goto failed_nilfs;
Makes sense to me.
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Thanks,
Slava.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] nilfs2: fix backing_dev_info reference leak
2026-05-07 21:41 ` Viacheslav Dubeyko
@ 2026-05-08 2:05 ` Ryusuke Konishi
2026-05-08 18:08 ` Viacheslav Dubeyko
0 siblings, 1 reply; 4+ messages in thread
From: Ryusuke Konishi @ 2026-05-08 2:05 UTC (permalink / raw)
To: Viacheslav Dubeyko
Cc: Shuangpeng Bai, Viacheslav Dubeyko, Christian Brauner,
linux-nilfs, linux-kernel
On Fri, May 8, 2026 at 6:41 AM Viacheslav Dubeyko wrote:
>
> On Thu, 2026-05-07 at 11:50 -0400, Shuangpeng Bai wrote:
> > setup_bdev_super() already initializes sb->s_bdev and takes a
> > reference on the block device backing_dev_info when assigning sb->s_bdi.
> >
> > nilfs_fill_super() takes another reference to the same
> > backing_dev_info and stores it in sb->s_bdi again. The extra
> > reference is not paired with a matching bdi_put(), since
> > generic_shutdown_super() releases sb->s_bdi only once.
> >
> > Drop the redundant bdi_get() in nilfs_fill_super(). The single
> > reference taken by setup_bdev_super() is enough and is released
> > during superblock shutdown.
> >
> > Fixes: c1e012ea9e83 ("nilfs2: use setup_bdev_super to de-duplicate the mount code")
> > Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
> > ---
> > fs/nilfs2/super.c | 2 --
> > 1 file changed, 2 deletions(-)
Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Viacheslav,
Could you please apply this directly?
I have also verified the fix and confirmed that the Fixes tag
correctly identifies the origin of the leak for backporting.
Thanks,
Ryusuke Konishi
> >
> > diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
> > index 7aa5ef8606cd..893a504cb80c 100644
> > --- a/fs/nilfs2/super.c
> > +++ b/fs/nilfs2/super.c
> > @@ -1070,8 +1070,6 @@ nilfs_fill_super(struct super_block *sb, struct fs_context *fc)
> > sb->s_time_gran = 1;
> > sb->s_max_links = NILFS_LINK_MAX;
> >
> > - sb->s_bdi = bdi_get(sb->s_bdev->bd_disk->bdi);
> > -
> > err = load_nilfs(nilfs, sb);
> > if (err)
> > goto failed_nilfs;
>
> Makes sense to me.
>
> Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
>
> Thanks,
> Slava.
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] nilfs2: fix backing_dev_info reference leak
2026-05-08 2:05 ` Ryusuke Konishi
@ 2026-05-08 18:08 ` Viacheslav Dubeyko
0 siblings, 0 replies; 4+ messages in thread
From: Viacheslav Dubeyko @ 2026-05-08 18:08 UTC (permalink / raw)
To: Ryusuke Konishi
Cc: Shuangpeng Bai, Viacheslav Dubeyko, Christian Brauner,
linux-nilfs, linux-kernel
On Fri, 2026-05-08 at 11:05 +0900, Ryusuke Konishi wrote:
> On Fri, May 8, 2026 at 6:41 AM Viacheslav Dubeyko wrote:
> >
> > On Thu, 2026-05-07 at 11:50 -0400, Shuangpeng Bai wrote:
> > > setup_bdev_super() already initializes sb->s_bdev and takes a
> > > reference on the block device backing_dev_info when assigning sb->s_bdi.
> > >
> > > nilfs_fill_super() takes another reference to the same
> > > backing_dev_info and stores it in sb->s_bdi again. The extra
> > > reference is not paired with a matching bdi_put(), since
> > > generic_shutdown_super() releases sb->s_bdi only once.
> > >
> > > Drop the redundant bdi_get() in nilfs_fill_super(). The single
> > > reference taken by setup_bdev_super() is enough and is released
> > > during superblock shutdown.
> > >
> > > Fixes: c1e012ea9e83 ("nilfs2: use setup_bdev_super to de-duplicate the mount code")
> > > Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
> > > ---
> > > fs/nilfs2/super.c | 2 --
> > > 1 file changed, 2 deletions(-)
>
> Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
>
> Viacheslav,
>
> Could you please apply this directly?
> I have also verified the fix and confirmed that the Fixes tag
> correctly identifies the origin of the leak for backporting.
>
Applied.
Thanks,
Slava.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-08 18:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 15:50 [PATCH] nilfs2: fix backing_dev_info reference leak Shuangpeng Bai
2026-05-07 21:41 ` Viacheslav Dubeyko
2026-05-08 2:05 ` Ryusuke Konishi
2026-05-08 18:08 ` Viacheslav Dubeyko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox