]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: do not call close_fs_devices in btrfs_rm_device
authorJosef Bacik <josef@toxicpanda.com>
Tue, 5 Oct 2021 20:12:41 +0000 (16:12 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Oct 2021 17:08:07 +0000 (19:08 +0200)
commitfcec279720c4cb7373f9577f78b8f3dfa03155f2
treed9c63ffcdd0109adffa37db7d0df4b4eb41b743c
parent6456d7799e751ecb7edfaee84c55d56758bc0ec0
btrfs: do not call close_fs_devices in btrfs_rm_device

There's a subtle case where if we're removing the seed device from a
file system we need to free its private copy of the fs_devices.  However
we do not need to call close_fs_devices(), because at this point there
are no devices left to close as we've closed the last one.  The only
thing that close_fs_devices() does is decrement ->opened, which should
be 1.  We want to avoid calling close_fs_devices() here because it has a
lockdep_assert_held(&uuid_mutex), and we are going to stop holding the
uuid_mutex in this path.

So simply decrement the  ->opened counter like we should, and then clean
up like normal.  Also add a comment explaining what we're doing here as
I initially removed this code erroneously.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c