diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2014-07-29 19:09:39 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-08-21 07:55:20 -0700 |
commit | 87fa3bb0786f37dff0b92f2c38421dd56d8902a9 (patch) | |
tree | b864ece48f86905381ddf890db911c972fa17e76 /fs/btrfs/sysfs.c | |
parent | 95669976bd7d30ae265db938ecb46a6b7f8cb893 (diff) | |
download | op-kernel-dev-87fa3bb0786f37dff0b92f2c38421dd56d8902a9.zip op-kernel-dev-87fa3bb0786f37dff0b92f2c38421dd56d8902a9.tar.gz |
Btrfs: fix regression of btrfs device replace
Commit 49c6f736f34f901117c20960ebd7d5e60f12fcac(
btrfs: dev replace should replace the sysfs entry) added the missing sysfs entry
in the process of device replace, but didn't take missing devices into account,
so now we have
BUG: unable to handle kernel NULL pointer dereference at 0000000000000088
IP: [<ffffffffa0268551>] btrfs_kobj_rm_device+0x21/0x40 [btrfs]
...
To reproduce it,
1. mkfs.btrfs -f disk1 disk2
2. mkfs.ext4 disk1
3. mount disk2 /mnt -odegraded
4. btrfs replace start -B 1 disk3 /mnt
--------------------------
This fixes the problem.
Reported-by: Chris Murphy <lists@colorremedies.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r-- | fs/btrfs/sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 7869936..12e5355 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -614,7 +614,7 @@ int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, if (!fs_info->device_dir_kobj) return -EINVAL; - if (one_device) { + if (one_device && one_device->bdev) { disk = one_device->bdev->bd_part; disk_kobj = &part_to_dev(disk)->kobj; |