Skip to content

Commit

Permalink
fs/btrfs/volumes.c:
Browse files Browse the repository at this point in the history
  • Loading branch information
josefbacik authored and pipcet committed Sep 1, 2021
1 parent a4c497c commit 4a5bac2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2183,9 +2183,17 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
synchronize_rcu();
btrfs_free_device(device);

/*
* This can happen if cur_devices is the private seed devices list. We
* cannot call close_fs_devices() here because it expects the uuid_mutex
* to be held, but in fact we don't need that for the private
* seed_devices, we can simply decrement cur_devices->opened and then
* remove it from our list and free the fs_devices.
*/
if (cur_devices->open_devices == 0) {
ASSERT(cur_devices->opened == 1);
list_del_init(&cur_devices->seed_list);
close_fs_devices(cur_devices);
cur_devices->opened--;
free_fs_devices(cur_devices);
}

Expand Down

0 comments on commit 4a5bac2

Please sign in to comment.