From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
Date: Thu, 7 Jun 2007 13:23:09 +0200 [thread overview]
Message-ID: <20070607112309.GY4735@kernel.dk> (raw)
In-Reply-To: <200706042203.l54M3rtf031762@mbox.iij4u.or.jp>
On Tue, Jun 05 2007, FUJITA Tomonori wrote:
> From: Jens Axboe <jens.axboe@oracle.com>
> Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
> Date: Mon, 4 Jun 2007 16:04:15 +0200
>
> > On Sun, Jun 03 2007, FUJITA Tomonori wrote:
> > > The previous commit to fix a blocking read bug put a bug that leads a
> > > deadlock on discarding done commands. We don't need bsg_device's lock
> > > there.
> > >
> > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > > ---
> > > block/bsg.c | 5 +----
> > > 1 files changed, 1 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/block/bsg.c b/block/bsg.c
> > > index 2f78d7d..9b5f6d7 100644
> > > --- a/block/bsg.c
> > > +++ b/block/bsg.c
> > > @@ -466,11 +466,8 @@ static int bsg_complete_all_commands(str
> > > */
> > > ret = 0;
> > > do {
> > > - spin_lock_irq(&bd->lock);
> > > - if (!bd->queued_cmds) {
> > > - spin_unlock_irq(&bd->lock);
> > > + if (!bd->queued_cmds)
> > > break;
> > > - }
> > >
> > > bc = bsg_get_done_cmd(bd);
> > > if (IS_ERR(bc))
> >
> > int read should be atomic, but it probably still needs serialization.
> > I'd be more comfortable with just adding the appropriate
> > spin_unlock_irq() before bsg_get_done_cmd(). It's not a fast path
> > anyway, just for device going away.
>
> Ok, here's a patch though only one is accessing to a bsg device here,
> I think. Anyway, sorry about the silly bug.
Thanks, applied.
> BTW, any chance to push bsg to mainline? The scsi mid-layer bidi is
> not ready, but the block layer bidi is ready with the rq->next_rq
> patch (and I have the bsg bidi patch). Then I can ask James to push
> the SMP pass through patches to mainline.
Sure, might as well get on with it. I'll push it once 2.6.23 opens.
--
Jens Axboe
next prev parent reply other threads:[~2007-06-07 11:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-03 13:18 [PATCH] bsg: fix the deadlock on discarding done commands FUJITA Tomonori
2007-06-04 14:04 ` Jens Axboe
2007-06-04 22:03 ` FUJITA Tomonori
2007-06-07 11:23 ` Jens Axboe [this message]
2007-06-08 15:11 ` FUJITA Tomonori
2007-06-08 15:20 ` Jens Axboe
2007-06-20 13:43 ` FUJITA Tomonori
2007-07-09 12:26 ` Jens Axboe
2007-07-09 13:02 ` FUJITA Tomonori
2007-07-09 13:24 ` Jens Axboe
2007-06-08 16:33 ` FUJITA Tomonori
2007-06-08 16:38 ` James Bottomley
2007-06-08 16:45 ` FUJITA Tomonori
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=20070607112309.GY4735@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.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