]> git.baikalelectronics.ru Git - kernel.git/commit
md: flush writes before starting a recovery.
authorNeilBrown <neilb@suse.de>
Wed, 2 Jul 2014 02:04:14 +0000 (12:04 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 3 Jul 2014 00:44:45 +0000 (10:44 +1000)
commit21f642f65d5b183960276e9e45bb12d01e99a5e8
tree129c8bd83f369efda8573797438605209b43b3e7
parentbb8708f8b85e7eeb32876b6af1063c6b74878fa8
md: flush writes before starting a recovery.

When we write to a degraded array which has a bitmap, we
make sure the relevant bit in the bitmap remains set when
the write completes (so a 're-add' can quickly rebuilt a
temporarily-missing device).

If, immediately after such a write starts, we incorporate a spare,
commence recovery, and skip over the region where the write is
happening (because the 'needs recovery' flag isn't set yet),
then that write will not get to the new device.

Once the recovery finishes the new device will be trusted, but will
have incorrect data, leading to possible corruption.

We cannot set the 'needs recovery' flag when we start the write as we
do not know easily if the write will be "degraded" or not.  That
depends on details of the particular raid level and particular write
request.

This patch fixes a corruption issue of long standing and so it
suitable for any -stable kernel.  It applied correctly to 3.0 at
least and will minor editing to earlier kernels.

Reported-by: Bill <billstuff2001@sbcglobal.net>
Tested-by: Bill <billstuff2001@sbcglobal.net>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/53A518BB.60709@sbcglobal.net
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c