Re: [RFC v2 1/6] fs: provide unlocked helper for freeze_super()

From: Christoph Hellwig
Date: Tue Apr 20 2021 - 08:06:33 EST


On Sat, Apr 17, 2021 at 12:10:21AM +0000, Luis Chamberlain wrote:
> freeze_super() holds a write lock, however we wish to also enable
> callers which already hold the write lock. To do this provide a helper
> and make freeze_super() use it. This way, all that freeze_super() does
> now is lock handling and active count management.

Can we take a step back and think about this a bit more?

freeze_super() has three callers:

1) freeze_bdev
2) ioctl_fsfreeze
3) freeze_store (in gfs2)

The first gets its reference from get_active_super, and is the only
caller of get_active_super. So IMHO we should just not drop the lock
in get_active_super and directly call the unlocked version.

The other two really should just call grab_super to get an active
reference and s_umount.

In other words: I don't think we need both variants, just move the
locking and s_active acquisition out of free_super. Same for the
thaw side.