btrfs-progs: Dont' stop scanning of devices at first failed device
authorYauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
Fri, 11 Mar 2016 00:04:35 +0000 (16:04 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2016 12:42:47 +0000 (13:42 +0100)
commit3ee935e4dd23a97de31a07e36b32871730801e05
treefd53c94b23563a1472fa15cef1f1b1eba2cc8568
parent83ad1dcbb09d68e11a7338b066571080e9264755
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 <yauhen.kharuzhy@zavadatar.com>
[ initialize err to 0 ]
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-device.c
utils.c