Re: [PATCH V3 1/4] blk-mq: serialize queue quiesce and unquiesce by mutex

Ming Lei
2020-09-09T01:16:59Z

On Tue, Sep 08, 2020 at 10:54:14AM -0700, Bart Van Assche wrote:
> On 2020-09-08 01:15, Ming Lei wrote:
> > void blk_mq_unquiesce_queue(struct request_queue *q)
> > {
> > + mutex_lock(&q->mq_quiesce_lock);
> > +
> > blk_queue_flag_clear(QUEUE_FLAG_QUIESCED, q);
> >
> > /* dispatch requests which are inserted during quiescing */
> > blk_mq_run_hw_queues(q, true);
> > +
> > + mutex_unlock(&q->mq_quiesce_lock);
> > }
> Has the sunvdc driver been retested? It calls blk_mq_unquiesce_queue()
> with a spinlock held. As you know calling mutex_lock() while holding a
> spinlock is not allowed.

I am wondering if sunvdc is still being actively used, the similar lock issue
has been existed since 7996a8b5511a ("blk-mq: fix hang caused by
freeze/unfreeze sequence") which is committed in May 2019.

+ spin_lock_irq(&port->vio.lock);
+ port->drain = 0;
+ blk_mq_unquiesce_queue(q);
+ blk_mq_unfreeze_queue(q);

mutex_lock is added to blk_mq_unfreeze_queue(q) since commit 7996a8b5511a.

Not see such report actually.

> There may be other drivers than the sunvdc driver that do this.

Most calls of blk_mq_unquiesce_queue are easily to be audited because
blk_mq_quiesce_queue is used in same callsite.

I will take a close look at this thing before posting next version.

Thanks,
Ming