]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: reada: lock all seed/sprout devices in __reada_start_machine
authorAnand Jain <anand.jain@oracle.com>
Fri, 4 Sep 2020 17:34:30 +0000 (01:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 7 Oct 2020 10:12:22 +0000 (12:12 +0200)
commit3b4915a71eafe594e0ef2721c4ee81862eaaa445
tree86eee6ef3563eb031520513468d6b2b8d91e4420
parenta6010913bca14fb47c09a441ba4de153a63ec8d0
btrfs: reada: lock all seed/sprout devices in __reada_start_machine

On an fs mounted using a sprout device, the seed fs_devices are
maintained in a linked list under fs_info->fs_devices. Each seeds
fs_devices also has device_list_mutex initialized to protect against the
potential race with delete threads. But the delete thread (at
btrfs_rm_device()) is holding the fs_info::fs_devices::device_list_mutex
mutex which belongs to sprout device_list_mutex instead of seed
device_list_mutex. Moreover, there aren't any significient benefits in
using the seed::device_list_mutex instead of sprout::device_list_mutex.

So this patch converts them of using the seed::device_list_mutex to
sprout::device_list_mutex.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/reada.c