+ md-fix-a-plug-unplug-race-in-raid5.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     md: fix a plug/unplug race in raid5

has been added to the -mm tree.  Its filename is

     md-fix-a-plug-unplug-race-in-raid5.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: md: fix a plug/unplug race in raid5
From: NeilBrown <neilb@xxxxxxx>

When a device is unplugged, requests are moved from one or two (depending on
whether a bitmap is in use) queues to the main request queue.

So whenever requests are put on either of those queues, we should make sure
the raid5 array is 'plugged'.  However we don't.  We currently plug the raid5
queue just before putting requests on queues, so there is room for a race.  If
something unplugs the queue at just the wrong time, requests will be left on
the queue and nothing will want to unplug them.  Normally something else will
plug and unplug the queue fairly soon, but there is a risk that nothing will.

Signed-off-by: Neil Brown <neilb@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/md/raid5.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff -puN drivers/md/raid5.c~md-fix-a-plug-unplug-race-in-raid5 drivers/md/raid5.c
--- a/drivers/md/raid5.c~md-fix-a-plug-unplug-race-in-raid5
+++ a/drivers/md/raid5.c
@@ -89,12 +89,14 @@ static void __release_stripe(raid5_conf_
 		BUG_ON(!list_empty(&sh->lru));
 		BUG_ON(atomic_read(&conf->active_stripes)==0);
 		if (test_bit(STRIPE_HANDLE, &sh->state)) {
-			if (test_bit(STRIPE_DELAYED, &sh->state))
+			if (test_bit(STRIPE_DELAYED, &sh->state)) {
 				list_add_tail(&sh->lru, &conf->delayed_list);
-			else if (test_bit(STRIPE_BIT_DELAY, &sh->state) &&
-				 conf->seq_write == sh->bm_seq)
+				blk_plug_device(conf->mddev->queue);
+			} else if (test_bit(STRIPE_BIT_DELAY, &sh->state) &&
+				   conf->seq_write == sh->bm_seq) {
 				list_add_tail(&sh->lru, &conf->bitmap_list);
-			else {
+				blk_plug_device(conf->mddev->queue);
+			} else {
 				clear_bit(STRIPE_BIT_DELAY, &sh->state);
 				list_add_tail(&sh->lru, &conf->handle_list);
 			}
@@ -2556,13 +2558,6 @@ static int raid5_issue_flush(request_que
 	return ret;
 }
 
-static inline void raid5_plug_device(raid5_conf_t *conf)
-{
-	spin_lock_irq(&conf->device_lock);
-	blk_plug_device(conf->mddev->queue);
-	spin_unlock_irq(&conf->device_lock);
-}
-
 static int make_request(request_queue_t *q, struct bio * bi)
 {
 	mddev_t *mddev = q->queuedata;
@@ -2672,7 +2667,6 @@ static int make_request(request_queue_t 
 				goto retry;
 			}
 			finish_wait(&conf->wait_for_overlap, &w);
-			raid5_plug_device(conf);
 			handle_stripe(sh, NULL);
 			release_stripe(sh);
 		} else {
_

Patches currently in -mm which might be from neilb@xxxxxxx are

origin.patch
generic_file_buffered_write-deadlock-on-vectored-write.patch
md-possible-fix-for-unplug-problem.patch
md-set-desc_nr-correctly-for-version-1-superblocks.patch
md-delay-starting-md-threads-until-array-is-completely-setup.patch
md-fix-resync-speed-calculation-for-restarted-resyncs.patch
md-fix-a-plug-unplug-race-in-raid5.patch
md-fix-some-small-races-in-bitmap-plugging-in-raid5.patch
md-fix-usage-of-wrong-variable-in-raid1.patch
md-unify-usage-of-symbolic-names-for-perms.patch
md-require-cap_sys_admin-for-re-configuring-md-devices-via-sysfs.patch
md-fix-will-configure-message-when-interpreting-md=-kernel-parameter.patch
md-include-sector-number-in-messages-about-corrected-read-errors.patch
md-dm-reduce-stack-usage-with-stacked-block-devices.patch
lockdep-annotate-sunrpc-code.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux