From: Bart Van Assche <bvanassche@acm.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: Hannes Reinecke <hare@suse.de>,
Christoph Hellwig <hch@infradead.org>,
Jens Axboe <axboe@kernel.dk>, Joe Lawrence <jdl1291@gmail.com>
Subject: Re: [PATCH RFC] Remove the cancel_delayed_work() call from scsi_put_command()
Date: Thu, 22 May 2014 19:41:06 +0200 [thread overview]
Message-ID: <537E36B2.6040500@acm.org> (raw)
In-Reply-To: <537E2435.7030705@redhat.com>
On 05/22/14 18:22, Paolo Bonzini wrote:
> Il 21/05/2014 15:30, Bart Van Assche ha scritto:
>> +static bool scmd_being_handled_in_other_context(struct scsi_cmnd *scmd)
>> +{
>> + struct Scsi_Host *shost = scmd->device->host;
>> + struct scsi_cmnd *c;
>> + unsigned long flags;
>> + bool ret = false;
>> +
>> + if (!blk_rq_completed(scmd->request))
>> + return true;
>> +
>> + spin_lock_irqsave(shost->host_lock, flags);
>> + list_for_each_entry(c, &shost->eh_cmd_q, eh_entry) {
>> + if (c == scmd) {
>> + ret = true;
>> + break;
>> + }
>> + }
>> + spin_unlock_irqrestore(shost->host_lock, flags);
>> +
>> + return ret;
>> +}
>> +
>> /**
>> * scmd_eh_abort_handler - Handle command aborts
>> * @work: command to be aborted.
>> @@ -120,6 +142,8 @@ scmd_eh_abort_handler(struct work_struct *work)
>> struct scsi_device *sdev = scmd->device;
>> int rtn;
>>
>> + WARN_ON_ONCE(scmd_being_handled_in_other_context(scmd));
>
> What about a simpler, though less accuracte
>
> WARN_ON(!blk_rq_completed(scmd->request));
>
> that doesn't need the host_lock?
One reason why I posted this patch as an RFC was to invite feedback. I'm
fine with leaving out the loop over the eh_cmd_q list although I do not
expect that will make a significant performance difference. None of the
functions in which a check was added are in the hot path.
Bart.
next prev parent reply other threads:[~2014-05-22 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 13:30 [PATCH RFC] Remove the cancel_delayed_work() call from scsi_put_command() Bart Van Assche
2014-05-22 16:22 ` Paolo Bonzini
2014-05-22 17:41 ` Bart Van Assche [this message]
2014-05-23 6:09 ` Hannes Reinecke
2014-05-23 9:24 ` Paolo Bonzini
2014-05-23 10:37 ` Bart Van Assche
2014-05-23 11:28 ` Paolo Bonzini
2014-05-23 11:36 ` Hannes Reinecke
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=537E36B2.6040500@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=jdl1291@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=pbonzini@redhat.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.