From: Arne Redlich Date: Tue, 31 Jul 2007 07:37:57 +0000 (-0700) Subject: md: handle writes to broken raid10 arrays gracefully X-Git-Tag: v2.6.23-rc2~114 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f6f953aa99d456aff44ffdb1c77061d1a010eae2;p=karo-tx-linux.git 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 Acked-by: Neil Brown Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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);