Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

From: Christoph Hellwig
Date: Tue Sep 26 2023 - 05:31:37 EST


On Thu, Sep 14, 2023 at 09:56:57AM +0200, Christian Brauner wrote:
> > BTW, this part of commit message in 2c18a63b760a is rather confused:
> > Recent rework moved block device closing out of sb->put_super() and into
> > sb->kill_sb() to avoid deadlocks as s_umount is held in put_super() and
> > blkdev_put() can end up taking s_umount again.
> >
> > That was *NOT* what a recent rework had done. Block device closing had never
> > been inside ->put_super() - at no point since that (closing, that is) had been
> > introduced back in 0.97 ;-) ->put_super() predates it (0.95c+).
>
> I think the commit message probably just isn't clear enough. The main
> block device of a superblock isn't closed in sb->put_super(). That's
> always been closed in kill_block_super() after generic_shutdown_super().

Yes.

> But afaict filesystem like ext4 and xfs may have additional block
> devices open exclusively and closed them in sb->put_super():
>
> xfs_fs_put_super()
> -> xfs_close_devices()
> -> xfs_blkdev_put()
> -> blkdev_put()
>
> ext4_put_super()
> -> ext4_blkdev_remove()
> -> blkdev_put()

Yes.