From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Cc: Brian King <brking@linux.vnet.ibm.com>,
linux-scsi@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v2 1/2] scsi: Handle Unit Attention when issuing SCSI command
Date: Thu, 20 Oct 2016 14:39:28 -0400 [thread overview]
Message-ID: <1476988768.3094.55.camel@HansenPartnership.com> (raw)
In-Reply-To: <87y41nhrv1.fsf@linux.vnet.ibm.com>
On Mon, 2016-10-17 at 14:17 -0200, Gabriel Krisman Bertazi wrote:
> James Bottomley <jejb@linux.vnet.ibm.com> writes:
>
> > On Thu, 2016-10-13 at 15:47 -0300, Gabriel Krisman Bertazi wrote:
> > > @@ -210,6 +219,13 @@ int scsi_execute(struct scsi_device *sdev,
> > > const
> > > unsigned char *cmd,
> > > */
> > > blk_execute_rq(req->q, NULL, req, 1);
> > >
> > > + if (scsi_sense_unit_attention(sense) && req->retries >
> > > 0) {
> > > + memset(sense, 0, SCSI_SENSE_BUFFERSIZE);
> > > + retries = req->retries - 1;
> > > + blk_put_request(req);
> > > + goto retry;
> > > + }
> >
> > OK, so this is more theory, but I think you can actually reuse the
> > same
> > request to go around this loop without doing a get/put. I've cc'd
> > Jens
> > to confirm, since no other driver I can find does this, but if it's
> > legal, it saves freeing and reallocating the request. You can then
> > replace the goto with a do { } while (...) which makes the loop
> > obvious
> > to the next person looking at this.
>
> Hi James,
>
> I don't think the block layer currently has the machinery to reuse
> the request. I think it would be easy to add for the MQ case but I
> don't know about SQ. If we don't clean up or reinit the request
> before re-sending, we'll hit the BUG_ON in blk_start_request:
>
> BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags));
>
> Do you wanna take a v3 of the patch and fix this on a future patch,
That works. I certainly believe, looking at the code, that we can
reuse the request, but in the absence from confirmation from Jens I'm
certainly not going to insist on it.
James
> or should I be looking into patching the block layer interface? I'll
> be looking into it, but I need to get familiar with the SQ code
> first.
prev parent reply other threads:[~2016-10-20 18:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 18:47 [PATCH v2 1/2] scsi: Handle Unit Attention when issuing SCSI command Gabriel Krisman Bertazi
2016-10-13 18:47 ` [PATCH v2 2/2] scsi: sr: Drop custom handling of unit attention Gabriel Krisman Bertazi
2016-10-14 5:19 ` [PATCH v2 1/2] scsi: Handle Unit Attention when issuing SCSI command James Bottomley
2016-10-17 16:17 ` Gabriel Krisman Bertazi
2016-10-17 17:30 ` Brian King
2016-10-20 18:39 ` James Bottomley [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=1476988768.3094.55.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=axboe@kernel.dk \
--cc=brking@linux.vnet.ibm.com \
--cc=krisman@linux.vnet.ibm.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.