[PATCH] md: fix locking problem in r5/r6
authorNeilBrown <neilb@suse.de>
Mon, 28 Nov 2005 21:44:10 +0000 (13:44 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 28 Nov 2005 22:42:25 +0000 (14:42 -0800)
bitmap_unplug actually writes data (bits) to storage, so we shouldn't be
holding a spinlock...

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/raid5.c
drivers/md/raid6main.c

index e2a40283e323b46335beedb18face0aad67eae00..36d5f8ac82650bfb4eda7ddce550b44af2f80ac1 100644 (file)
@@ -1704,7 +1704,9 @@ static void raid5d (mddev_t *mddev)
 
                if (conf->seq_flush - conf->seq_write > 0) {
                        int seq = conf->seq_flush;
+                       spin_unlock_irq(&conf->device_lock);
                        bitmap_unplug(mddev->bitmap);
+                       spin_lock_irq(&conf->device_lock);
                        conf->seq_write = seq;
                        activate_bit_delay(conf);
                }
index eae5a35629c59101372d31518ecba9daa4e77814..17d88d90d1ef89970a34567fe2154128ad1a09e1 100644 (file)
@@ -1784,7 +1784,9 @@ static void raid6d (mddev_t *mddev)
 
                if (conf->seq_flush - conf->seq_write > 0) {
                        int seq = conf->seq_flush;
+                       spin_unlock_irq(&conf->device_lock);
                        bitmap_unplug(mddev->bitmap);
+                       spin_lock_irq(&conf->device_lock);
                        conf->seq_write = seq;
                        activate_bit_delay(conf);
                }