瀏覽代碼

md/raid5: flush out all pending requests before proceeding with reshape.

Some requests - particularly 'discard' and 'read' are handled
differently depending on whether a reshape is active or not.

It is harmless to assume reshape is active if it isn't but wrong
to act as though reshape is not active when it is.

So when we start reshape - after making clear to all requests that
reshape has started - use mddev_suspend/mddev_resume to flush out all
requests.  This will ensure that no requests will be assuming the
absence of reshape once it really starts.

Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown 12 年之前
父節點
當前提交
4d77e3ba88
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      drivers/md/raid5.c

+ 7 - 0
drivers/md/raid5.c

@@ -6279,6 +6279,13 @@ static int raid5_start_reshape(struct mddev *mddev)
 	write_seqcount_end(&conf->gen_lock);
 	write_seqcount_end(&conf->gen_lock);
 	spin_unlock_irq(&conf->device_lock);
 	spin_unlock_irq(&conf->device_lock);
 
 
+	/* Now make sure any requests that proceeded on the assumption
+	 * the reshape wasn't running - like Discard or Read - have
+	 * completed.
+	 */
+	mddev_suspend(mddev);
+	mddev_resume(mddev);
+
 	/* Add some new drives, as many as will fit.
 	/* Add some new drives, as many as will fit.
 	 * We know there are enough to make the newly sized array work.
 	 * We know there are enough to make the newly sized array work.
 	 * Don't add devices if we are reducing the number of
 	 * Don't add devices if we are reducing the number of