public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Arjan van de Ven <arjanv@redhat.com>
Cc: "Justin T. Gibbs" <Justin_Gibbs@adaptec.com>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] 2.4.X Avoid excessive recursion when setting device offline
Date: Tue, 30 Mar 2004 09:03:53 +0200	[thread overview]
Message-ID: <20040330070353.GN24370@suse.de> (raw)
In-Reply-To: <1080581208.3570.10.camel@laptop.fenrus.com>

On Mon, Mar 29 2004, Arjan van de Ven wrote:
> On Mon, 2004-03-29 at 19:07, Justin T. Gibbs wrote:
> > How to reproduce: Queue up lots of I/O to a device.  Set that device
> > 		  offline.
> > 
> > Result: The SCSI mid-layer blows out the kernel stack due to the inherent
> > 	recursion in its request function.  The repeating stack trace goes
> > 	something like:
> > 
> > 	scsi_request_fn
> > 	__scsi_end_request
> > 	scsi_release_command
> > 	scsi_queue_next_request
> > 	scsi_request_fn
> > 	...
> > 
> > This patch prevents recursive calls through the scsi_request_fn
> > for the same queue:
> 
> won't this achieve the same ?
> 
> diff -urN Linux/drivers/scsi/scsi_lib.c linux/drivers/scsi/scsi_lib.c
> --- Linux/drivers/scsi/scsi_lib.c       2002-10-03 16:50:07.000000000
> +0200
> +++ linux/drivers/scsi/scsi_lib.c       2002-10-03 17:33:20.000000000
> +0200
> @@ -442,7 +442,7 @@
>          * This will goose the queue request function at the end, so we
> don't
>          * need to worry about launching another command.
>          */
> -       scsi_release_command(SCpnt);
> +       __scsi_release_command(SCpnt);
>   
>         if( frequeue ) {
>                 request_queue_t *q;
> 

> diff -urN Linux/drivers/scsi/scsi_lib.c linux/drivers/scsi/scsi_lib.c
> --- Linux/drivers/scsi/scsi_lib.c	2002-10-03 16:50:07.000000000 +0200
> +++ linux/drivers/scsi/scsi_lib.c	2002-10-03 17:33:20.000000000 +0200
> @@ -442,7 +442,7 @@
>  	 * This will goose the queue request function at the end, so we don't
>  	 * need to worry about launching another command.
>  	 */
> -	scsi_release_command(SCpnt);
> +	__scsi_release_command(SCpnt);
>  
>  	if( frequeue ) {
>  		request_queue_t *q;

That is better. If SCSI used blk_start_queue/stop_queue, it has
recursion detection as well (only allowing one reenter).

-- 
Jens Axboe


      parent reply	other threads:[~2004-03-30  7:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-29 17:07 [PATCH] 2.4.X Avoid excessive recursion when setting device offline Justin T. Gibbs
2004-03-29 17:26 ` Arjan van de Ven
2004-03-29 17:42   ` Justin T. Gibbs
2004-03-29 17:47   ` James Bottomley
2004-03-29 17:52     ` Justin T. Gibbs
2004-03-30  7:03   ` Jens Axboe [this message]

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=20040330070353.GN24370@suse.de \
    --to=axboe@suse.de \
    --cc=Justin_Gibbs@adaptec.com \
    --cc=arjanv@redhat.com \
    --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