error = -ENOMEM;
goto out;
}
+ mutex_lock(&uuid_mutex);
error = btrfs_scan_one_device(device_name,
flags, holder, fs_devices);
+ mutex_unlock(&uuid_mutex);
kfree(device_name);
if (error)
goto out;
return ERR_PTR(error);
}
+ mutex_lock(&uuid_mutex);
error = btrfs_scan_one_device(device_name, mode, fs_type, &fs_devices);
+ mutex_unlock(&uuid_mutex);
if (error)
goto error_sec_opts;
switch (cmd) {
case BTRFS_IOC_SCAN_DEV:
+ mutex_lock(&uuid_mutex);
ret = btrfs_scan_one_device(vol->name, FMODE_READ,
&btrfs_root_fs_type, &fs_devices);
+ mutex_unlock(&uuid_mutex);
break;
case BTRFS_IOC_DEVICES_READY:
+ mutex_lock(&uuid_mutex);
ret = btrfs_scan_one_device(vol->name, FMODE_READ,
&btrfs_root_fs_type, &fs_devices);
- if (ret)
+ if (ret) {
+ mutex_unlock(&uuid_mutex);
break;
+ }
ret = !(fs_devices->num_devices == fs_devices->total_devices);
+ mutex_unlock(&uuid_mutex);
break;
case BTRFS_IOC_GET_SUPPORTED_FEATURES:
ret = btrfs_ioctl_get_supported_features((void __user*)arg);
int ret = 0;
u64 bytenr;
+ lockdep_assert_held(&uuid_mutex);
+
/*
* we would like to check all the supers, but that would make
* a btrfs mount succeed after a mkfs from a different FS.
goto error_bdev_put;
}
- mutex_lock(&uuid_mutex);
device = device_list_add(path, disk_super, &new_device_added);
if (IS_ERR(device)) {
ret = PTR_ERR(device);
if (new_device_added)
btrfs_free_stale_devices(path, device);
}
- mutex_unlock(&uuid_mutex);
btrfs_release_disk_super(page);