From: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
To: James Bottomley <jejb@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: Mon, 17 Oct 2016 14:17:54 -0200 [thread overview]
Message-ID: <87y41nhrv1.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1476422360.22309.29.camel@linux.vnet.ibm.com> (James Bottomley's message of "Fri, 14 Oct 2016 13:19:20 +0800")
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, 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.
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2016-10-17 16:18 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 [this message]
2016-10-17 17:30 ` Brian King
2016-10-20 18:39 ` James Bottomley
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=87y41nhrv1.fsf@linux.vnet.ibm.com \
--to=krisman@linux.vnet.ibm.com \
--cc=axboe@kernel.dk \
--cc=brking@linux.vnet.ibm.com \
--cc=jejb@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).