public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.vnet.ibm.com>
To: Jinpu Wang <jinpu.wang@profitbricks.com>
Cc: Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@infradead.org>,
	linux-scsi@vger.kernel.org,
	Sebastian Parschauer <s.parschauer@gmx.de>,
	Bart Van Assche <bart.vanassche@sandisk.com>
Subject: Re: [PATCHv2]sd: Don't treat succeeded SYNC as error
Date: Tue, 10 May 2016 09:00:39 -0700	[thread overview]
Message-ID: <1462896039.2320.21.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAMGffEnxn203HX6JDxUO21vtV3FyRpy6qdArgzX4zNPgGp8JLA@mail.gmail.com>

On Tue, 2016-05-10 at 17:46 +0200, Jinpu Wang wrote:
> On Tue, May 10, 2016 at 5:08 PM, James Bottomley
> <jejb@linux.vnet.ibm.com> wrote:
[...]
> > Actually, I think this is symptomatic of a much bigger problem. 
> >  Now that the FS can send zero length non BLOCK_PC request, we're 
> > not treating failure correctly.  blk_update_request() will always
> > finish them becuase they have no bytes outstanding (not having any 
> > in the first case).  So I think we need a special exception for all 
> > zero length commands which complete with a failure to allow them to
> > retry (if required).
> 
> Which request do you mean, I only find FLUSH?

Flush is the only one currently, but zero length fs requests didn't
exist when this bit of SCSI was coded, which is why all the code judges
request completion on have we completed all the bytes (which is
obviously true if you had no bytes to send in the first place).

> I will test your patch.

Thanks.

James

> Thanks,
> Jack
> 
> > 
> > James
> > 
> > ---
> > 
> > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> > index 8106515..5a97866 100644
> > --- a/drivers/scsi/scsi_lib.c
> > +++ b/drivers/scsi/scsi_lib.c
> > @@ -911,9 +911,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd,
> > unsigned int good_bytes)
> >         }
> > 
> >         /*
> > -        * If we finished all bytes in the request we are done now.
> > +        * special case: failed zero length commands always need to
> > +        * drop down into the retry code. Otherwise, if we finished
> > +        * all bytes in the request we are done now.
> >          */
> > -       if (!scsi_end_request(req, error, good_bytes, 0))
> > +       if (!(good_bytes == 0 && blk_rq_bytes(req) == 0 && result
> > != 0) &&
> > +           !scsi_end_request(req, error, good_bytes, 0))
> >                 return;
> > 
> >         /*
> > 
> 
> 
> 


  reply	other threads:[~2016-05-10 16:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29 12:49 [PATCHv2]sd: Don't treat succeeded SYNC as error Jinpu Wang
2016-05-02 10:05 ` Hannes Reinecke
2016-05-02 13:44   ` James Bottomley
2016-05-02 13:57     ` James Bottomley
2016-05-04 17:02     ` Jinpu Wang
2016-05-09 16:41       ` Jinpu Wang
2016-05-10 14:48         ` Jinpu Wang
2016-05-10 15:08           ` James Bottomley
2016-05-10 15:46             ` Jinpu Wang
2016-05-10 16:00               ` James Bottomley [this message]
2016-05-11  8:21                 ` Jinpu Wang
2016-05-11  6:21             ` Hannes Reinecke
2016-05-11  6:43               ` James Bottomley
2016-05-11 15:05                 ` James Bottomley
2016-05-12 13:22                   ` Jinpu Wang

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=1462896039.2320.21.camel@linux.vnet.ibm.com \
    --to=jejb@linux.vnet.ibm.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jinpu.wang@profitbricks.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=s.parschauer@gmx.de \
    /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