Re: [PATCH] bsg: fix the deadlock on discarding done commands

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

 



On Tue, Jun 05 2007, FUJITA Tomonori wrote:
> From: Jens Axboe <jens.axboe@xxxxxxxxxx>
> 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@xxxxxxxxxxxxx>
> > > ---
> > >  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

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux