On Mon, Apr 04, 2022 at 09:41:36AM -0400, Gabriel Krisman Bertazi wrote: > In order to expose tmpfs statistics on sysfs, add the boilerplate code > to create the /sys/fs/tmpfs structure. As suggested on a previous > review, this uses the minor as the volume directory in /sys/fs/. > > This takes care of not exposing SB_NOUSER mounts. I don't think we have > a usecase for showing them and, since they don't appear elsewhere, they > might be confusing to users. > > Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx> > +static void shmem_unregister_sysfs(struct super_block *sb) > +{ > + struct shmem_sb_info *sbinfo = SHMEM_SB(sb); > + > + kobject_del(&sbinfo->s_kobj); > + kobject_put(&sbinfo->s_kobj); > + wait_for_completion(&sbinfo->s_kobj_unregister); > +} If you embed kobject into something, you basically commit to having the lifetime rules maintained by that kobject...