Re: [PATCH 2/5] block: add queue reset support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/25/2016 12:55 AM, mchristi@xxxxxxxxxx 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux