From 4a770891d9ddf94df985ca438e78d355b8469247 Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Fri, 19 Jun 2015 11:52:52 -0700 Subject: [PATCH] Btrfs: fix parity scrub of RAID 5/6 with missing device When testing the previous patch, Zhao Lei reported a similar bug when attempting to scrub a degraded RAID 5/6 filesystem with a missing device, leading to NULL pointer dereferences from the RAID 5/6 parity scrubbing code. The first cause was the same as in the previous patch: attempting to call bio_add_page() on a missing block device. To fix this, scrub_extent_for_parity() can just mark the sectors on the missing device as errors instead of attempting to read from it. Additionally, the code uses scrub_remap_extent() to map the extent of the corresponding data stripe, but the extent wasn't already mapped. If scrub_remap_extent() finds a missing block device, it doesn't initialize extent_dev, so we're left with a NULL struct btrfs_device. The solution is to use btrfs_map_block() directly. Reported-by: Zhao Lei Signed-off-by: Omar Sandoval Signed-off-by: Chris Mason --- Reading git-format-patch failed