summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2015-08-14 11:11:10 +1000
committerNeilBrown <neilb@suse.com>2015-08-31 19:43:23 +0200
commit55ce74d4bfe1b9444436264c637f39a152d1e5ac (patch)
tree2d5803d1e058d7fb9b15e605c1f75981f866332d /drivers/md/md.c
parent18b9f67962eb890da0c053e04c3cf0e91871d4fa (diff)
downloadop-kernel-dev-55ce74d4bfe1b9444436264c637f39a152d1e5ac.zip
op-kernel-dev-55ce74d4bfe1b9444436264c637f39a152d1e5ac.tar.gz
md/raid1: ensure device failure recorded before write request returns.
When a write to one of the legs of a RAID1 fails, the failure is recorded in the metadata of the other leg(s) so that after a restart the data on the failed drive wont be trusted even if that drive seems to be working again (maybe a cable was unplugged). Similarly when we record a bad-block in response to a write failure, we must not let the write complete until the bad-block update is safe. Currently there is no interlock between the write request completing and the metadata update. So it is possible that the write will complete, the app will confirm success in some way, and then the machine will crash before the metadata update completes. This is an extremely small hole for a racy to fit in, but it is theoretically possible and so should be closed. So: - set MD_CHANGE_PENDING when requesting a metadata update for a failed device, so we can know with certainty when it completes - queue requests that experienced an error on a new queue which is only processed after the metadata update completes - call raid_end_bio_io() on bios in that queue when the time comes. Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7d5a6ced..8644ce7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8629,6 +8629,7 @@ int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors,
/* Make sure they get written out promptly */
sysfs_notify_dirent_safe(rdev->sysfs_state);
set_bit(MD_CHANGE_CLEAN, &rdev->mddev->flags);
+ set_bit(MD_CHANGE_PENDING, &rdev->mddev->flags);
md_wakeup_thread(rdev->mddev->thread);
}
return rv;
OpenPOWER on IntegriCloud