]> err.no Git - linux-2.6/commitdiff
md: handle writes to broken raid10 arrays gracefully
authorArne Redlich <agr@powerkom-dd.de>
Tue, 31 Jul 2007 07:37:57 +0000 (00:37 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 31 Jul 2007 22:39:38 +0000 (15:39 -0700)
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>
drivers/md/raid10.c

index 0c97bf4f686e85158df81c1cfbe54945789226a0..4e53792aa520b8c5fc0aa18df1266dae15d998bf 100644 (file)
@@ -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);