@@ -606,7 +606,7 @@ static void pending_bios_fn(struct btrfs_work *work)
}
-static void btrfs_free_stale_device(struct btrfs_device *cur_dev)
+static void btrfs_free_stale_device(struct btrfs_device *cur_dev, char *path)
{
struct btrfs_fs_devices *fs_devs, *tmp_fs_devs;
struct btrfs_device *dev, *tmp_dev;
@@ -633,6 +633,8 @@ static void btrfs_free_stale_device(struct btrfs_device *cur_dev)
if (cur_dev)
not_found = strcmp(rcu_str_deref(dev->name),
rcu_str_deref(cur_dev->name));
+ else if (path)
+ not_found = strcmp(rcu_str_deref(dev->name), path);
else
not_found = 0;
rcu_read_unlock();
@@ -776,7 +778,7 @@ static noinline int device_list_add(const char *path,
ret = 1;
device->fs_devices = fs_devices;
- btrfs_free_stale_device(device);
+ btrfs_free_stale_device(device, NULL);
} else if (!device->name || strcmp(device->name->str, path)) {
/*
* When FS is already mounted.