blob: a4fe31f243cdf1ac14536901aadd79b7dcef5a45 [file] [log] [blame]
From stable-bounces@linux.kernel.org Tue Jul 31 00:47:41 2007
From: Arne Redlich <agr@powerkom-dd.de>
Date: Tue, 31 Jul 2007 00:37:57 -0700
Subject: md: handle writes to broken raid10 arrays gracefully
To: torvalds@linux-foundation.org
Cc: neilb@suse.de, akpm@linux-foundation.org, stable@kernel.org, agr@powerkom-dd.de
Message-ID: <200707310737.l6V7bvG2021938@imap1.linux-foundation.org>
From: Arne Redlich <agr@powerkom-dd.de>
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/md/raid10.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -917,6 +917,13 @@ static int make_request(request_queue_t
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);