* [PATCH] Btrfs: fix regression of btrfs device replace
@ 2014-07-29 11:09 Liu Bo
2014-08-11 21:41 ` Chris Murphy
0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2014-07-29 11:09 UTC (permalink / raw)
To: linux-btrfs
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>
---
fs/btrfs/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Btrfs: fix regression of btrfs device replace
2014-07-29 11:09 [PATCH] Btrfs: fix regression of btrfs device replace Liu Bo
@ 2014-08-11 21:41 ` Chris Murphy
2014-08-12 2:25 ` Satoru Takeuchi
0 siblings, 1 reply; 4+ messages in thread
From: Chris Murphy @ 2014-08-11 21:41 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Jul 29, 2014, at 5:09 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> 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>
> ---
> fs/btrfs/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
>
Applied to 3.16.0 and tested, problem is fixed.
Chris Murphy
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Btrfs: fix regression of btrfs device replace
2014-08-11 21:41 ` Chris Murphy
@ 2014-08-12 2:25 ` Satoru Takeuchi
2014-08-12 3:00 ` Liu Bo
0 siblings, 1 reply; 4+ messages in thread
From: Satoru Takeuchi @ 2014-08-12 2:25 UTC (permalink / raw)
To: Chris Murphy, Liu Bo; +Cc: linux-btrfs
Hi Liu,
(2014/08/12 6:41), Chris Murphy wrote:
>
> On Jul 29, 2014, at 5:09 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
>
>> 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>
>> ---
>> fs/btrfs/sysfs.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> 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;
>>
>
>
> Applied to 3.16.0 and tested, problem is fixed.
>
>
> Chris Murphy
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
I confirmed both
- This problem happens with 3.16, and
- This problem doesn't happen with 3.16 + your patch.
Thanks,
Satoru
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Btrfs: fix regression of btrfs device replace
2014-08-12 2:25 ` Satoru Takeuchi
@ 2014-08-12 3:00 ` Liu Bo
0 siblings, 0 replies; 4+ messages in thread
From: Liu Bo @ 2014-08-12 3:00 UTC (permalink / raw)
To: Satoru Takeuchi, Chris Murphy; +Cc: linux-btrfs
On Tue, Aug 12, 2014 at 11:25:00AM +0900, Satoru Takeuchi wrote:
> Hi Liu,
>
> (2014/08/12 6:41), Chris Murphy wrote:
> >
> >On Jul 29, 2014, at 5:09 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> >
> >>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>
> >>---
> >>fs/btrfs/sysfs.c | 2 +-
> >>1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >>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;
> >>
> >
> >
> >Applied to 3.16.0 and tested, problem is fixed.
> >
> >
> >Chris Murphy
>
> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
>
> I confirmed both
>
> - This problem happens with 3.16, and
> - This problem doesn't happen with 3.16 + your patch.
Thanks for your testing!
-liubo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-12 3:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-29 11:09 [PATCH] Btrfs: fix regression of btrfs device replace Liu Bo
2014-08-11 21:41 ` Chris Murphy
2014-08-12 2:25 ` Satoru Takeuchi
2014-08-12 3:00 ` Liu Bo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).