btrfs-progs: Fix bug when scanned for devid which was missing and deleted
authorAnand Jain <Anand.Jain@oracle.com>
Mon, 24 Feb 2014 11:43:39 +0000 (19:43 +0800)
committerChris Mason <clm@fb.com>
Fri, 21 Mar 2014 13:23:28 +0000 (06:23 -0700)
commitfbf186bf87e727ccad5f476b54e240e3bd6d2350
tree744b3c820d6d51945fe5b14f47492bbdf276eb2d
parent9567dc89521ba83f3dba561c82a3f6b9aff30a02
btrfs-progs: Fix bug when scanned for devid which was missing and deleted

get_fs_info() provides the info of the specific
device/devid, however when we delete the missing disk
the super-block on the disk isn't cleared, and since
btrfs-progs makes its decision by reading the disk super
block, so it doesn't know about the kernel previous action,
And now when we tried to probe kernel for the devid it fails.

reproducer:

$ mkfs.btrfs -d raid1 -m raid1 /dev/sde /dev/sdf
$ modprobe -r btrfs && modprobe btrfs
$ mount -o degraded /dev/sde /btrfs
$ btrfs dev add /dev/sdd /btrfs
$ btrfs dev del missing /btrfs
$ btrfs scrub start -B /dev/sdf
btrfs: utils.c:1741: get_fs_info: Assertion `!(ndevs == 0)' failed.
Aborted (core dumped)

Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
utils.c