• Christian Brauner's avatar
    super: wait until we passed kill super · 2c18a63b
    Christian Brauner authored
    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 means we need to move the removal of the superblock from @fs_supers
    out of generic_shutdown_super() and into deactivate_locked_super() to
    ensure that concurrent mounters don't fail to open block devices that
    are still in use because blkdev_put() in sb->kill_sb() hasn't been
    called yet.
    
    We can now do this as we can make iterators through @fs_super and
    @super_blocks wait without holding s_umount. Concurrent mounts will wait
    until a dying superblock is fully dead so until sb->kill_sb() has been
    called and SB_DEAD been set. Concurrent iterators can already discard
    any SB_DYING superblock.
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    Message-Id: <20230818-vfs-super-fixes-v3-v3-4-9f0b1876e46b@kernel.org>
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    2c18a63b
super.c 51.8 KB