From 3ee935e4dd23a97de31a07e36b32871730801e05 Mon Sep 17 00:00:00 2001 From: Yauhen Kharuzhy Date: Thu, 10 Mar 2016 16:04:35 -0800 Subject: btrfs-progs: Dont' stop scanning of devices at first failed device When 'btrfs device scan' command is invoked, it scans all devices, check them for btrfs superblock and add devices with btrfs to a list. Next, each device from the list is passed to kernel where it is handled in the btrfs_scan_one_device() function. This function can, for example, return -EBUSY when device contains superblock matched to existing and mounted filesystem (if this device was pulled out from RAID and connected again after some time). btrfs tool stops device scan if any device has been failed to add, so other existing devices with (possibly) valid FS will never be reached. Fix this by remove stopping at any failure in the btrfs_register_all_devices(), just return error count. btrfs_scan_one_device() reports any kind of error already. Signed-off-by: Yauhen Kharuzhy [ initialize err to 0 ] Signed-off-by: David Sterba --- cmds-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmds-device.c') diff --git a/cmds-device.c b/cmds-device.c index fff05e4c..a8f10f6d 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -254,7 +254,7 @@ static int cmd_device_scan(int argc, char **argv) ret = btrfs_scan_lblkid(); error_on(ret, "error %d while scanning", ret); ret = btrfs_register_all_devices(); - error_on(ret, "error %d while registering devices", ret); + error_on(ret, "there are %d errors while registering devices", ret); goto out; } -- cgit v1.2.3