From: Mike Christie <michaelc@cs.wisc.edu>
To: Ravi Anand <ravi.anand@qlogic.com>
Cc: James Bottomley <james.bottomley@suse.de>,
Linux-SCSI Mailing List <linux-scsi@vger.kernel.org>,
Vikas Chaudhary <vikas.chaudhary@qlogic.com>,
Karen Higgins <karen.higgins@qlogic.com>
Subject: Re: [PATCH 09/12] qla4xxx: added srb reference counter
Date: Tue, 06 Apr 2010 23:47:28 -0500 [thread overview]
Message-ID: <4BBC0E60.3020209@cs.wisc.edu> (raw)
In-Reply-To: <20100406101432.GP22922@linux-qf4p>
On 04/06/2010 05:14 AM, Ravi Anand wrote:
> @@ -888,7 +890,7 @@ static void qla4xxx_flush_active_srbs(struct scsi_qla_host *ha)
> srb = qla4xxx_del_from_active_array(ha, i);
> if (srb != NULL) {
> srb->cmd->result = DID_RESET<< 16;
> - qla4xxx_srb_compl(ha, srb);
> + kref_put(&srb->srb_ref, qla4xxx_srb_compl);
> }
> *
> * This routine waits for the command to be returned by the Firmware
> @@ -1507,17 +1509,14 @@ static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha,
> struct scsi_cmnd *cmd)
> {
> int done = 0;
> - struct srb *rp;
> uint32_t max_wait_time = EH_WAIT_CMD_TOV;
>
> do {
> /* Checking to see if its returned to OS */
> - rp = (struct srb *) cmd->SCp.ptr;
> - if (rp == NULL) {
> + if (cmd->host_scribble == NULL) {
> done++;
> break;
> }
Is this racey? It seems like qla4xxx_flush_active_srbs will call
qla4xxx_del_from_active_array and that will clear host_scribble, and
here we will see it is NULL and proceed to complete the eh abort
process. When we get back to qla4xxx_eh_abort we could call
kref_put(&srb->srb_ref, qla4xxx_srb_compl) and then return SUCCESS to
the scsi eh. The scsi eh will then begin to reuse the scsi cmd to send a
TUR. But I think the problem could be that if happens before
qla4xxx_flush_active_srbs has called its kref_put, then when
qla4xxx_flush_active_srbs now calls it it is going to call
qla4xxx_srb_compl and the driver will be completing a completely
different command (it would now be the TUR).
I thought I had said this before, but it looks like I did not get a
reply. I think you want to drop the kref coming into
qla4xxx_eh_wait_on_command because nothing is touching the srb now. And
then you want to add some locking in around the host_scribble checking
maybe.
prev parent reply other threads:[~2010-04-07 4:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-06 10:14 [PATCH 09/12] qla4xxx: added srb reference counter Ravi Anand
2010-04-07 4:47 ` Mike Christie [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=4BBC0E60.3020209@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=james.bottomley@suse.de \
--cc=karen.higgins@qlogic.com \
--cc=linux-scsi@vger.kernel.org \
--cc=ravi.anand@qlogic.com \
--cc=vikas.chaudhary@qlogic.com \
/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.