On 05/25/2016 12:55 AM, mchri...@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.

+       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?

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to