diff options
author | Guoqing Jiang <gqjiang@suse.com> | 2017-10-24 03:11:51 -0400 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-11-02 00:32:23 -0400 |
commit | cb8a7a7e1098e74d36378b992a6d012668ec10d9 (patch) | |
tree | 54461d8655ba8219f2c1bce3669a8503cd2e5c06 | |
parent | d4098c7262a47f529765d89614484a957363d623 (diff) |
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 <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r-- | drivers/md/raid10.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 61890231972e..cc6a56a659a3 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, | |||
1294 | sector_t sectors; | 1294 | sector_t sectors; |
1295 | int max_sectors; | 1295 | int max_sectors; |
1296 | 1296 | ||
1297 | if ((mddev_is_clustered(mddev) && | ||
1298 | md_cluster_ops->area_resyncing(mddev, WRITE, | ||
1299 | bio->bi_iter.bi_sector, | ||
1300 | bio_end_sector(bio)))) { | ||
1301 | DEFINE_WAIT(w); | ||
1302 | for (;;) { | ||
1303 | prepare_to_wait(&conf->wait_barrier, | ||
1304 | &w, TASK_IDLE); | ||
1305 | if (!md_cluster_ops->area_resyncing(mddev, WRITE, | ||
1306 | bio->bi_iter.bi_sector, bio_end_sector(bio))) | ||
1307 | break; | ||
1308 | schedule(); | ||
1309 | } | ||
1310 | finish_wait(&conf->wait_barrier, &w); | ||
1311 | } | ||
1312 | |||
1297 | /* | 1313 | /* |
1298 | * Register the new request and wait if the reconstruction | 1314 | * Register the new request and wait if the reconstruction |
1299 | * thread has put up a bar for new requests. | 1315 | * thread has put up a bar for new requests. |