Re: [PATCH] binderfs: rework superblock destruction

From: Al Viro
Date: Wed Aug 17 2022 - 10:19:32 EST


On Wed, Aug 17, 2022 at 04:01:49PM +0200, Christian Brauner wrote:
> On Wed, Aug 17, 2022 at 02:59:02PM +0100, Al Viro wrote:
> > On Wed, Aug 17, 2022 at 03:03:06PM +0200, Christian Brauner wrote:
> >
> > > +static void binderfs_kill_super(struct super_block *sb)
> > > +{
> > > + struct binderfs_info *info = sb->s_fs_info;
> > > +
> > > + if (info && info->ipc_ns)
> > > + put_ipc_ns(info->ipc_ns);
> > > +
> > > + kfree(info);
> > > + kill_litter_super(sb);
> > > +}
> >
> > Other way round, please - shut the superblock down, *then*
> > free the objects it'd been using. IOW,
>
> I wondered about that but a lot of places do it the other way around.
> So maybe the expected order should be documented somewhere.

???

"If you are holding internal references to dentries/inodes/etc., drop them
first; if you are going to free something that is used by filesystem
methods, don't do that before the filesystem is shut down"

That's just common sense... Which filesystems are doing that "the other
way around"?