On Thu, Aug 17, 2023 at 02:50:21PM +0200, Jan Kara wrote: > > +/** > > + * super_wait - wait for superblock to become ready > > + * @sb: superblock to wait for > > + * @excl: whether exclusive access is required > > + * > > + * If the superblock has neither passed through vfs_get_tree() or > > + * generic_shutdown_super() yet wait for it to happen. Either superblock > > + * creation will succeed and SB_BORN is set by vfs_get_tree() or we're > > + * woken and we'll see SB_DYING. > > + * > > + * The caller must have acquired a temporary reference on @sb->s_count. > > + * > > + * Return: true if SB_BORN was set, false if SB_DYING was set. > > The comment should mention that this acquires s_umount and returns with it > held. Also the name is a bit too generic for my taste and not expressing > the fact this is in fact a lock operation. Maybe something like > super_lock_wait_born()? Isn't this actually the normal function we want people to call? So maybe this function should be called super_lock() and the functions in the last patch get called __super_lock() for raw access to the lock. I'm also a little wary that this isn't _killable. Are we guaranteed that a superblock will transition to BORN or DYING within a limited time? This isn't part of the VFS I know well.