md: avoid a possibility that a read error can wrongly propagate through md/raid1...
authorNeilBrown <neilb@suse.de>
Thu, 10 May 2007 10:15:50 +0000 (03:15 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 10 May 2007 16:26:53 +0000 (09:26 -0700)
commitdd00a99e7a4b739bd41ef4093760efc7e447f963
tree2bb5bfafc0de89bd00ef530540e91e8297fc5d57
parentc5ddb547e899993be56dc7d0bf72bfd7a8d4ae1e
md: avoid a possibility that a read error can wrongly propagate through md/raid1 to a filesystem.

When a raid1 has only one working drive, we want read error to propagate up
to the filesystem as there is no point failing the last drive in an array.

Currently the code perform this check is racy.  If a write and a read a
both submitted to a device on a 2-drive raid1, and the write fails followed
by the read failing, the read will see that there is only one working drive
and will pass the failure up, even though the one working drive is actually
the *other* one.

So, tighten up the locking.

Signed-off-by: Neil Brown <neilb@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/raid1.c