public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bsg: fix the deadlock on discarding done commands
@ 2007-06-03 13:18 FUJITA Tomonori
  2007-06-04 14:04 ` Jens Axboe
  0 siblings, 1 reply; 13+ messages in thread
From: FUJITA Tomonori @ 2007-06-03 13:18 UTC (permalink / raw)
  To: jens.axboe; +Cc: linux-scsi

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))
-- 
1.4.3.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Jens Axboe @ 2007-06-04 14:04 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi

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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-04 14:04 ` Jens Axboe
@ 2007-06-04 22:03   ` FUJITA Tomonori
  2007-06-07 11:23     ` Jens Axboe
  0 siblings, 1 reply; 13+ messages in thread
From: FUJITA Tomonori @ 2007-06-04 22:03 UTC (permalink / raw)
  To: jens.axboe; +Cc: fujita.tomonori, linux-scsi

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.

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.


diff --git a/block/bsg.c b/block/bsg.c
index 2f78d7d..5f4abc9 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -471,6 +471,7 @@ static int bsg_complete_all_commands(str
 			spin_unlock_irq(&bd->lock);
 			break;
 		}
+		spin_unlock_irq(&bd->lock);
 
 		bc = bsg_get_done_cmd(bd);
 		if (IS_ERR(bc))
-- 
1.4.3.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-04 22:03   ` FUJITA Tomonori
@ 2007-06-07 11:23     ` Jens Axboe
  2007-06-08 15:11       ` FUJITA Tomonori
  2007-06-08 16:33       ` FUJITA Tomonori
  0 siblings, 2 replies; 13+ messages in thread
From: Jens Axboe @ 2007-06-07 11:23 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-07 11:23     ` Jens Axboe
@ 2007-06-08 15:11       ` FUJITA Tomonori
  2007-06-08 15:20         ` Jens Axboe
  2007-06-08 16:33       ` FUJITA Tomonori
  1 sibling, 1 reply; 13+ messages in thread
From: FUJITA Tomonori @ 2007-06-08 15:11 UTC (permalink / raw)
  To: jens.axboe; +Cc: fujita.tomonori, linux-scsi

From: Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
Date: Thu, 7 Jun 2007 13:23:09 +0200

> 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.

Cool, thanks.

I'll submit the bsg bidi patches shortly.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-08 15:11       ` FUJITA Tomonori
@ 2007-06-08 15:20         ` Jens Axboe
  2007-06-20 13:43           ` FUJITA Tomonori
  0 siblings, 1 reply; 13+ messages in thread
From: Jens Axboe @ 2007-06-08 15:20 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi

On Sat, Jun 09 2007, FUJITA Tomonori wrote:
> I'll submit the bsg bidi patches shortly.

Great - I see them, will review and integrate next week.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-07 11:23     ` Jens Axboe
  2007-06-08 15:11       ` FUJITA Tomonori
@ 2007-06-08 16:33       ` FUJITA Tomonori
  2007-06-08 16:38         ` James Bottomley
  1 sibling, 1 reply; 13+ messages in thread
From: FUJITA Tomonori @ 2007-06-08 16:33 UTC (permalink / raw)
  To: James.Bottomley; +Cc: jens.axboe, fujita.tomonori, linux-scsi

From: Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
Date: Thu, 7 Jun 2007 13:23:09 +0200

> 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.

James, any chance that the SMP passthru patches will be got into
2.6.23?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-08 16:33       ` FUJITA Tomonori
@ 2007-06-08 16:38         ` James Bottomley
  2007-06-08 16:45           ` FUJITA Tomonori
  0 siblings, 1 reply; 13+ messages in thread
From: James Bottomley @ 2007-06-08 16:38 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: jens.axboe, linux-scsi

On Sat, 2007-06-09 at 01:33 +0900, FUJITA Tomonori wrote:
> James, any chance that the SMP passthru patches will be got into
> 2.6.23?

Yes, assuming we get sufficient progress on the required bidi bits.

I think we've got several weeks yet to get the 2.6.23 queue in shape

James



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-08 16:38         ` James Bottomley
@ 2007-06-08 16:45           ` FUJITA Tomonori
  0 siblings, 0 replies; 13+ messages in thread
From: FUJITA Tomonori @ 2007-06-08 16:45 UTC (permalink / raw)
  To: James.Bottomley; +Cc: fujita.tomonori, jens.axboe, linux-scsi

From: James Bottomley <James.Bottomley@SteelEye.com>
Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
Date: Fri, 08 Jun 2007 11:38:08 -0500

> On Sat, 2007-06-09 at 01:33 +0900, FUJITA Tomonori wrote:
> > James, any chance that the SMP passthru patches will be got into
> > 2.6.23?
> 
> Yes, assuming we get sufficient progress on the required bidi bits.
> 
> I think we've got several weeks yet to get the 2.6.23 queue in shape

Great, thanks. I'll update and send the SMP passthru patches on the
top of Jens' tree when Jens applies the bsg bidi patchset.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-08 15:20         ` Jens Axboe
@ 2007-06-20 13:43           ` FUJITA Tomonori
  2007-07-09 12:26             ` Jens Axboe
  0 siblings, 1 reply; 13+ messages in thread
From: FUJITA Tomonori @ 2007-06-20 13:43 UTC (permalink / raw)
  To: jens.axboe; +Cc: fujita.tomonori, linux-scsi

From: Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
Date: Fri, 8 Jun 2007 17:20:49 +0200

> On Sat, Jun 09 2007, FUJITA Tomonori wrote:
> > I'll submit the bsg bidi patches shortly.
> 
> Great - I see them, will review and integrate next week.

Any progress on this?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-06-20 13:43           ` FUJITA Tomonori
@ 2007-07-09 12:26             ` Jens Axboe
  2007-07-09 13:02               ` FUJITA Tomonori
  0 siblings, 1 reply; 13+ messages in thread
From: Jens Axboe @ 2007-07-09 12:26 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi

On Wed, Jun 20 2007, FUJITA Tomonori wrote:
> From: Jens Axboe <jens.axboe@oracle.com>
> Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
> Date: Fri, 8 Jun 2007 17:20:49 +0200
> 
> > On Sat, Jun 09 2007, FUJITA Tomonori wrote:
> > > I'll submit the bsg bidi patches shortly.
> > 
> > Great - I see them, will review and integrate next week.
> 
> Any progress on this?

Please resend the bsg bidi patches so I can integrate them, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-07-09 12:26             ` Jens Axboe
@ 2007-07-09 13:02               ` FUJITA Tomonori
  2007-07-09 13:24                 ` Jens Axboe
  0 siblings, 1 reply; 13+ messages in thread
From: FUJITA Tomonori @ 2007-07-09 13:02 UTC (permalink / raw)
  To: jens.axboe; +Cc: linux-scsi, tomof

From: Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
Date: Mon, 9 Jul 2007 14:26:44 +0200

> On Wed, Jun 20 2007, FUJITA Tomonori wrote:
> > From: Jens Axboe <jens.axboe@oracle.com>
> > Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
> > Date: Fri, 8 Jun 2007 17:20:49 +0200
> > 
> > > On Sat, Jun 09 2007, FUJITA Tomonori wrote:
> > > > I'll submit the bsg bidi patches shortly.
> > > 
> > > Great - I see them, will review and integrate next week.
> > 
> > Any progress on this?
> 
> Please resend the bsg bidi patches so I can integrate them, thanks.

Great!

I've just sent the patchset against the latest your bsg branch.

BTW, seems that you forget to add my sign-off in the last two patches
in the bsg branch.

Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] bsg: fix the deadlock on discarding done commands
  2007-07-09 13:02               ` FUJITA Tomonori
@ 2007-07-09 13:24                 ` Jens Axboe
  0 siblings, 0 replies; 13+ messages in thread
From: Jens Axboe @ 2007-07-09 13:24 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi, tomof

On Mon, Jul 09 2007, FUJITA Tomonori wrote:
> From: Jens Axboe <jens.axboe@oracle.com>
> Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
> Date: Mon, 9 Jul 2007 14:26:44 +0200
> 
> > On Wed, Jun 20 2007, FUJITA Tomonori wrote:
> > > From: Jens Axboe <jens.axboe@oracle.com>
> > > Subject: Re: [PATCH] bsg: fix the deadlock on discarding done commands
> > > Date: Fri, 8 Jun 2007 17:20:49 +0200
> > > 
> > > > On Sat, Jun 09 2007, FUJITA Tomonori wrote:
> > > > > I'll submit the bsg bidi patches shortly.
> > > > 
> > > > Great - I see them, will review and integrate next week.
> > > 
> > > Any progress on this?
> > 
> > Please resend the bsg bidi patches so I can integrate them, thanks.
> 
> Great!
> 
> I've just sent the patchset against the latest your bsg branch.

Thanks!

> BTW, seems that you forget to add my sign-off in the last two patches
> in the bsg branch.

Oh, my mistake, will add them. I just rebased it to 2.6.22 this morning.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-07-09 13:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox