All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Reed <mdr@sgi.com>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] 2.6.25-rc4-git3 - inquiry cmd issued via /dev/sg? device causes infinite loop in 2.6.24
Date: Fri, 14 Mar 2008 08:11:42 -0500	[thread overview]
Message-ID: <47DA798E.5080305@sgi.com> (raw)
In-Reply-To: <47D8002C.9010306@panasas.com>



Boaz Harrosh wrote:
<snip>
>>
>>> Just to demonstrate what I mean a patch is attached. Just as an RFC, totally
>>> untested.
>> I can try this out and see what happens.
>>
>>
> Will not compile here is a cleaner one

Still in my queue.  Hopefully I'll get to poke at this today.

Mike

> 
> ---
> From: Boaz Harrosh <bharrosh@panasas.com>
> Date: Wed, 12 Mar 2008 13:18:49 +0200
> Subject: [PATCH] scsi: Always complete BLOCK_PC commands
> 
> Current code, in some IO combinations could wrongly retry
> a BLOCK_PC command in chunks. This was never intended.
> Fix it that BLOCK_PC will always complete atomically
> 
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> ---
>  drivers/scsi/scsi_lib.c |   24 +++++++++++++-----------
>  1 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index ba21d97..4b8b57c 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -784,14 +784,20 @@ EXPORT_SYMBOL(scsi_release_buffers);
>   * in req->data_len and req->next_rq->data_len. The upper-layer driver can
>   * decide what to do with this information.
>   */
> -void scsi_end_bidi_request(struct scsi_cmnd *cmd)
> +static void scsi_end_blk_request(struct scsi_cmnd *cmd)
>  {
>  	struct request *req = cmd->request;
>  	unsigned int dlen = req->data_len;
> -	unsigned int next_dlen = req->next_rq->data_len;
> +	unsigned int next_dlen;
>  
> -	req->data_len = scsi_out(cmd)->resid;
> -	req->next_rq->data_len = scsi_in(cmd)->resid;
> +	if (blk_bidi_rq(req)) {
> +		next_dlen = req->next_rq->data_len;
> +		req->data_len = scsi_out(cmd)->resid;
> +		req->next_rq->data_len = scsi_in(cmd)->resid;
> +	} else {
> +		next_dlen = 0;
> +		req->data_len = scsi_get_resid(cmd);
> +	}
>  
>  	/* The req and req->next_rq have not been completed */
>  	BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen));
> @@ -866,15 +872,11 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
>  				req->sense_len = len;
>  			}
>  		}
> -		if (scsi_bidi_cmnd(cmd)) {
> -			/* will also release_buffers */
> -			scsi_end_bidi_request(cmd);
> -			return;
> -		}
> -		req->data_len = scsi_get_resid(cmd);
> +		/* will also release_buffers */
> +		scsi_end_blk_request(cmd);
> +		return;
>  	}
>  
> -	BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */
>  	scsi_release_buffers(cmd);
>  
>  	/*

  reply	other threads:[~2008-03-14 13:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11 22:10 [PATCH] 2.6.25-rc4-git3 - inquiry cmd issued via /dev/sg? device causes infinite loop in 2.6.24 Michael Reed
2008-03-12 10:46 ` Boaz Harrosh
2008-03-12 16:03   ` Michael Reed
2008-03-12 16:09     ` Boaz Harrosh
2008-03-14 13:11       ` Michael Reed [this message]
2008-03-18 16:12         ` Michael Reed
2008-03-18 16:20           ` Boaz Harrosh
2008-03-18 16:52             ` Michael Reed
2008-03-18 17:19               ` Boaz Harrosh
2008-03-19 15:57                 ` Michael Reed
2008-03-19 16:18                   ` Boaz Harrosh
2008-03-19 21:34                     ` Michael Reed
2008-03-18 17:13             ` Michael Reed
2008-03-18 18:23               ` Boaz Harrosh
2008-03-18 19:51                 ` Michael Reed
2008-03-19  9:49                   ` Boaz Harrosh
2008-03-17 18:08 ` Mike Christie
2008-03-18  0:48   ` 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=47DA798E.5080305@sgi.com \
    --to=mdr@sgi.com \
    --cc=bharrosh@panasas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.