linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Neil Brown <neilb@suse.de>, Arthur Jones <ajones@riverbed.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-raid@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: [PULL REQUEST] md bug fixes and minor improvements
Date: Fri, 01 Aug 2008 10:34:48 -0700	[thread overview]
Message-ID: <1217612088.24551.5.camel@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <20080801172231.GF20055@kernel.dk>


On Fri, 2008-08-01 at 19:22 +0200, Jens Axboe wrote:
> It is a bit asymmetrical, largely due to the fact that the ->unplug_fn()
> itself grabs the lock. The below patch should fix it, since Neil has
> added a proper queue lock to the md queues. If someone can confirm that
> this fixes it, I'll queue up a patch with proper descriptions.
> 
> > I guess Jens is gone too..
> 
> I'm back, just been busy this week :-)
> 
> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
> index 621a272..f19b52f 100644
> --- a/drivers/md/bitmap.c
> +++ b/drivers/md/bitmap.c
> @@ -1234,7 +1234,9 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
>  		case 0:
>  			bitmap_file_set_bit(bitmap, offset);
>  			bitmap_count_page(bitmap,offset, 1);
> +			spin_lock_irq(&bitmap->mddev->queue->queue_lock);
>  			blk_plug_device(bitmap->mddev->queue);
> +			spin_unlock_irq(&bitmap->mddev->queue->queue_lock);
>  			/* fall through */
>  		case 1:
>  			*bmc = 2;
> 

We also need to protect the blk_plug_device call a few lines down (and
an obvious compile fix).

diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 621a272..c1b07e7 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1224,7 +1224,9 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
 			prepare_to_wait(&bitmap->overflow_wait, &__wait,
 					TASK_UNINTERRUPTIBLE);
 			spin_unlock_irq(&bitmap->lock);
+			spin_lock_irq(bitmap->mddev->queue->queue_lock);
 			blk_unplug(bitmap->mddev->queue);
+			spin_unlock_irq(bitmap->mddev->queue->queue_lock);
 			schedule();
 			finish_wait(&bitmap->overflow_wait, &__wait);
 			continue;
@@ -1234,7 +1236,9 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
 		case 0:
 			bitmap_file_set_bit(bitmap, offset);
 			bitmap_count_page(bitmap,offset, 1);
+			spin_lock_irq(bitmap->mddev->queue->queue_lock);
 			blk_plug_device(bitmap->mddev->queue);
+			spin_unlock_irq(bitmap->mddev->queue->queue_lock);
 			/* fall through */
 		case 1:
 			*bmc = 2;




  reply	other threads:[~2008-08-01 17:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01  3:02 [PULL REQUEST] md bug fixes and minor improvements Neil Brown
2008-08-01 17:16 ` Linus Torvalds
2008-08-01 17:22   ` Jens Axboe
2008-08-01 17:34     ` Dan Williams [this message]
2008-08-01 17:40       ` Jens Axboe
2008-08-01 18:22         ` Dan Williams
2008-08-01 18:29           ` Jens Axboe
2008-08-01 18:18     ` Linus Torvalds
2008-08-01 18:22       ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217612088.24551.5.camel@dwillia2-linux.ch.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=ajones@riverbed.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).