]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid1: make sure resync waits for conflicting writes to complete.
authorNeilBrown <neilb@suse.de>
Wed, 10 Sep 2014 05:01:49 +0000 (15:01 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 22 Sep 2014 01:26:01 +0000 (11:26 +1000)
commit94a13d2d6157e82b94e276fa6b7ffb1a5fb3a4d7
tree0db851e83a73d78afd9056063fec19656d02c9e3
parent6ad8e806cb93e66e47917b7f07ed34b959a09e0e
md/raid1: make sure resync waits for conflicting writes to complete.

The resync/recovery process for raid1 was recently changed
so that writes could happen in parallel with resync providing
they were in different regions of the device.

There is a problem though:  While a write request will always
wait for conflicting resync to complete, a resync request
will *not* always wait for conflicting writes to complete.

Two changes are needed to fix this:

1/ raise_barrier (which waits until it is safe to do resync)
   must wait until current_window_requests is zero
2/ wait_battier (which waits at the start of a new write request)
   must update current_window_requests if the request could
   possible conflict with a concurrent resync.

As concurrent writes and resync can lead to data loss,
this patch is suitable for -stable.

Fixes: e392bfc1d3ad94b1774445ed8d2d5cc893c0d378
Cc: stable@vger.kernel.org (v3.13+)
Cc: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid1.c