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.j...@oracle.com> --- fs/btrfs/super.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index b9efe58..74ef9bf 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -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: -- 2.0.0.257.g75cc6c6 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html