@@ -1857,6 +1857,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
struct btrfs_fs_devices *fs_devices;
int ret = -ENOTTY;
void __user *argp = (void __user *)arg;
+ struct btrfs_device *dev;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -1882,6 +1883,14 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
kfree(vol);
if (ret)
break;
+
+ list_for_each_entry(dev, &fs_devices->devices, dev_list) {
+ if (dev->name)
+ continue;
+
+ return !0;
+ }
+
ret = !(fs_devices->num_devices == fs_devices->total_devices);
break;
case BTRFS_IOC_GET_FSLIST:
reproducer: mkfs.btrfs -f -draid1 -mraid1 /dev/sdf /dev/sdd modprobe -r btrfs && modprobe btrfs mount -o degraded /dev/sdd /btrfs <-- calls add_missing_dev() to add missing btrfs_device umount /btrfs btrfs dev ready /dev/sdd echo $? 0 mount /dev/sdd /btrfs mount: wrong fs type, bad option, bad superblock on /dev/sdd, missing codepage or helper program, or other error fix this by checking if the device name is present in the BTRFS_IOC_DEVICES_READY ioctl Signed-off-by: Anand Jain <Anand.Jain@oracle.com> --- fs/btrfs/super.c | 9 +++++++++ 1 file changed, 9 insertions(+)