Bug ID | 1025057 |
---|---|
Summary | Btrfs: fix device replace of a missing RAID 5/6 device |
Classification | openSUSE |
Product | openSUSE Distribution |
Version | Leap 42.1 |
Hardware | Other |
OS | Other |
Status | NEW |
Severity | Normal |
Priority | P5 - None |
Component | Kernel |
Assignee | jeffm@suse.com |
Reporter | jeffm@suse.com |
QA Contact | qa-bugs@suse.de |
Found By | --- |
Blocker | --- |
From: Omar Sandoval <osandov@fb.com> Date: Fri, 19 Jun 2015 11:52:51 -0700 Subject: Btrfs: fix device replace of a missing RAID 5/6 device Git-commit: 73ff61dbe5edeb1799d7e91c8b0641f87feb75fa Patch-mainline: v4.3-rc1 References: revisit The original implementation of device replace on RAID 5/6 seems to have missed support for replacing a missing device. When this is attempted, we end up calling bio_add_page() on a bio with a NULL ->bi_bdev, which crashes when we try to dereference it. This happens because btrfs_map_block() has no choice but to return us the missing device because RAID 5/6 don't have any alternate mirrors to read from, and a missing device has a NULL bdev. The idea implemented here is to handle the missing device case separately, which better only happen when we're replacing a missing RAID 5/6 device. We use the new BTRFS_RBIO_REBUILD_MISSING operation to reconstruct the data from parity, check it with scrub_recheck_block_checksum(), and write it out with scrub_write_block_to_dev_replace(). Reported-by: Philip <bugzilla@philip-seeger.de> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96141 Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Chris Mason <clm@fb.com> Acked-by: Jeff Mahoney <jeffm@suse.com> --- fs/btrfs/scrub.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 147 insertions(+), 10 deletions(-)