@@ -790,6 +790,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
struct rcu_string *name;
u64 found_transid = btrfs_super_generation(disk_super);
u64 devid = btrfs_stack_device_id(&disk_super->dev_item);
+ bool multi_disk = btrfs_super_num_devices(disk_super) > 1;
bool has_metadata_uuid = (btrfs_super_incompat_flags(disk_super) &
BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
bool fsid_change_in_progress = (btrfs_super_flags(disk_super) &
@@ -918,7 +919,8 @@ static noinline struct btrfs_device *device_list_add(const char *path,
* tracking a problem where systems fail mount by subvolume id
* when we reject replacement on a mounted FS.
*/
- if (!fs_devices->opened && found_transid < device->generation) {
+ if (multi_disk && !fs_devices->opened &&
+ found_transid < device->generation) {
/*
* That is if the FS is _not_ mounted and if you
* are here, that means there is more than one
@@ -926,6 +928,10 @@ static noinline struct btrfs_device *device_list_add(const char *path,
* with larger generation number or the last-in if
* generation are equal.
*/
+ btrfs_warn_in_rcu(device->fs_info,
+ "old device %s not being added for fsid:devid for %pU:%llu",
+ rcu_str_deref(device->name),
+ disk_super->fsid, devid);
mutex_unlock(&fs_devices->device_list_mutex);
return ERR_PTR(-EEXIST);
}