From: Guoqing Jiang Date: Tue, 24 Oct 2017 07:11:51 +0000 (+0800) Subject: md-cluster: Suspend writes in RAID10 if within range X-Git-Tag: v4.19~2210^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb8a7a7e1098e74d36378b992a6d012668ec10d9;p=platform%2Fkernel%2Flinux-rpi.git md-cluster: Suspend writes in RAID10 if within range If there is a resync going on, all nodes must suspend writes to the range. This is recorded in suspend_info and suspend_list. If there is an I/O within the ranges of any of the suspend_info, area_resyncing will return 1. Signed-off-by: Guoqing Jiang Signed-off-by: Shaohua Li --- diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 6189023..cc6a56a 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1294,6 +1294,22 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio, sector_t sectors; int max_sectors; + if ((mddev_is_clustered(mddev) && + md_cluster_ops->area_resyncing(mddev, WRITE, + bio->bi_iter.bi_sector, + bio_end_sector(bio)))) { + DEFINE_WAIT(w); + for (;;) { + prepare_to_wait(&conf->wait_barrier, + &w, TASK_IDLE); + if (!md_cluster_ops->area_resyncing(mddev, WRITE, + bio->bi_iter.bi_sector, bio_end_sector(bio))) + break; + schedule(); + } + finish_wait(&conf->wait_barrier, &w); + } + /* * Register the new request and wait if the reconstruction * thread has put up a bar for new requests.