summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorArne Redlich <agr@powerkom-dd.de>2007-07-31 00:37:57 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 15:39:38 -0700
commitf6f953aa99d456aff44ffdb1c77061d1a010eae2 (patch)
tree9a708f373c8d1d8c94c1494e25add4a08b6ce782 /drivers/md/raid10.c
parent14e713446aaca97dbe590fe845f7dcbd74ddbee2 (diff)
downloadlinux-f6f953aa99d456aff44ffdb1c77061d1a010eae2.tar.gz
linux-f6f953aa99d456aff44ffdb1c77061d1a010eae2.tar.bz2
linux-f6f953aa99d456aff44ffdb1c77061d1a010eae2.zip
md: handle writes to broken raid10 arrays gracefully
When writing to a broken array, raid10 currently happily emits empty bio lists. IOW, the master bio will never be completed, sending writers to UNINTERRUPTIBLE_SLEEP forever. Signed-off-by: Arne Redlich <agr@powerkom-dd.de> Acked-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>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 0c97bf4f686e..4e53792aa520 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -917,6 +917,13 @@ static int make_request(struct request_queue *q, struct bio * bio)
bio_list_add(&bl, mbio);
}
+ if (unlikely(!atomic_read(&r10_bio->remaining))) {
+ /* the array is dead */
+ md_write_end(mddev);
+ raid_end_bio_io(r10_bio);
+ return 0;
+ }
+
bitmap_startwrite(mddev->bitmap, bio->bi_sector, r10_bio->sectors, 0);
spin_lock_irqsave(&conf->device_lock, flags);
bio_list_merge(&conf->pending_bio_list, &bl);