diff options
author | Josef Bacik <jbacik@fusionio.com> | 2012-08-02 10:22:20 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-08-28 16:53:29 -0400 |
commit | aa9ddcd4b5557102fa25695c11904f249b4dec49 (patch) | |
tree | 5ed695e48b6d32fd45e582496edc1b3da6f3b5f0 | |
parent | 3627bf4503b504077332c13496cb1bd54713bcbb (diff) |
Btrfs: do not use missing devices when showing devname
If you do the following
mkfs.btrfs /dev/sdb /dev/sdc
rmmod btrfs
dd if=/dev/zero of=/dev/sdb bs=1M count=1
mount -o degraded /dev/sdc /mnt/btrfs-test
the box will panic trying to deref the name for the missing dev since it is
the lower numbered devid. So fix show_devname to not use missing devices.
Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r-- | fs/btrfs/super.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 75ee2c7791f0..2e06f124f284 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1505,6 +1505,8 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) | |||
1505 | while (cur_devices) { | 1505 | while (cur_devices) { |
1506 | head = &cur_devices->devices; | 1506 | head = &cur_devices->devices; |
1507 | list_for_each_entry(dev, head, dev_list) { | 1507 | list_for_each_entry(dev, head, dev_list) { |
1508 | if (dev->missing) | ||
1509 | continue; | ||
1508 | if (!first_dev || dev->devid < first_dev->devid) | 1510 | if (!first_dev || dev->devid < first_dev->devid) |
1509 | first_dev = dev; | 1511 | first_dev = dev; |
1510 | } | 1512 | } |