From: Mike Christie <mchristi@redhat.com>
To: Bart Van Assche <bart.vanassche@sandisk.com>,
linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
target-devel@vger.kernel.org
Subject: Re: [PATCH 2/5] block: add queue reset support
Date: Wed, 25 May 2016 14:16:15 -0500 [thread overview]
Message-ID: <5745F9FF.7070101@redhat.com> (raw)
In-Reply-To: <f30ef794-b7ed-36d3-a268-b3bd6249ae50@sandisk.com>
On 05/25/2016 11:13 AM, Bart Van Assche wrote:
> On 05/25/2016 12:55 AM, mchristi@redhat.com wrote:
>> + spin_lock_irq(q->queue_lock);
>> + wait_event_lock_irq(q->reset_wq,
>> + !queue_flag_test_and_set(QUEUE_FLAG_RESETTING, q),
>> + *q->queue_lock);
>> + if (blk_queue_dead(q)) {
>> + rc = -ENODEV;
>> + spin_unlock_irq(q->queue_lock);
>> + goto done;
>> + }
>> + spin_unlock_irq(q->queue_lock);
>
> Is the flag QUEUE_FLAG_RESETTING used to serialize blk_reset_queue()
> calls? If so, please consider using a mutex instead. Lockdep can detect
> lock inversion for mutexes and spinlocks but not for serialization that
> is based on wait_event_lock_irq() loops.
Will do.
>
>> + if (q->mq_ops) {
>> + blk_mq_stop_hw_queues(q);
>> + blk_mq_freeze_queue(q);
>> +
>> + eh_rc = q->mq_ops->reset(q);
>> +
>> + blk_mq_unfreeze_queue(q);
>> + blk_mq_start_stopped_hw_queues(q, true);
>> + } else if (q->reset_fn) {
>> + spin_lock_irq(q->queue_lock);
>> + blk_stop_queue(q);
>> + spin_unlock_irq(q->queue_lock);
>> +
>> + while (q->request_fn_active)
>> + msleep(10);
>> +
>> + eh_rc = q->reset_fn(q);
>> +
>> + spin_lock_irq(q->queue_lock);
>> + blk_start_queue(q);
>> + spin_unlock_irq(q->queue_lock);
>> + }
>
> Some of the above code is similar to some of the code in
> scsi_internal_device_block() and scsi_internal_device_unblock(). Have
> you considered to avoid this duplication by introducing helpers in the
> block layer for blocking and unblocking queues?
>
Will do. Thanks.
next prev parent reply other threads:[~2016-05-25 19:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 7:54 [PATCH 0/5] block/target queue/LUN reset support mchristi
2016-05-25 7:54 ` [PATCH 1/5] blk mq: take ref to q when running it mchristi
2016-05-25 15:53 ` Bart Van Assche
2016-05-25 19:15 ` Mike Christie
2016-05-25 19:20 ` Mike Christie
2016-05-25 7:55 ` [PATCH 2/5] block: add queue reset support mchristi
2016-05-25 16:13 ` Bart Van Assche
2016-05-25 19:16 ` Mike Christie [this message]
2016-05-25 7:55 ` [PATCH 3/5] target: call queue reset if supported mchristi
2016-05-27 8:22 ` Christoph Hellwig
2016-05-25 7:55 ` [PATCH 4/5] scsi: add new async device reset support mchristi
2016-05-27 8:23 ` Christoph Hellwig
2016-05-27 9:16 ` Hannes Reinecke
2016-05-30 6:27 ` Hannes Reinecke
2016-05-31 19:38 ` Mike Christie
2016-05-31 19:59 ` Mike Christie
2016-05-31 20:34 ` Mike Christie
2016-05-25 7:55 ` [PATCH 5/5] iscsi initiator: support eh_async_device_reset_handler mchristi
2016-05-30 6:37 ` [PATCH 0/5] block/target queue/LUN reset support Hannes Reinecke
2016-05-31 19:56 ` Mike Christie
2016-06-01 6:05 ` 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=5745F9FF.7070101@redhat.com \
--to=mchristi@redhat.com \
--cc=bart.vanassche@sandisk.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=target-devel@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).