Commit 29cc83f6 authored by Liu Bo's avatar Liu Bo Committed by Chris Mason

Btrfs: fix NULL pointer crash of deleting a seed device

Same as normal devices, seed devices should be initialized with
fs_info->dev_root as well, otherwise we'll get a NULL pointer crash.

Cc: Chris Murphy <lists@colorremedies.com>
Reported-by: default avatarChris Murphy <lists@colorremedies.com>
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent f017f15f
...@@ -6146,10 +6146,14 @@ void btrfs_init_devices_late(struct btrfs_fs_info *fs_info) ...@@ -6146,10 +6146,14 @@ void btrfs_init_devices_late(struct btrfs_fs_info *fs_info)
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
struct btrfs_device *device; struct btrfs_device *device;
while (fs_devices) {
mutex_lock(&fs_devices->device_list_mutex); mutex_lock(&fs_devices->device_list_mutex);
list_for_each_entry(device, &fs_devices->devices, dev_list) list_for_each_entry(device, &fs_devices->devices, dev_list)
device->dev_root = fs_info->dev_root; device->dev_root = fs_info->dev_root;
mutex_unlock(&fs_devices->device_list_mutex); mutex_unlock(&fs_devices->device_list_mutex);
fs_devices = fs_devices->seed;
}
} }
static void __btrfs_reset_dev_stats(struct btrfs_device *dev) static void __btrfs_reset_dev_stats(struct btrfs_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment