Re: [PATCH v7 21/23] block: Avoid that flushing triggers a lockdep complaint

From: Peter Zijlstra
Date: Tue Feb 26 2019 - 12:24:38 EST


On Thu, Feb 14, 2019 at 03:00:56PM -0800, Bart Van Assche wrote:
> @@ -472,7 +473,8 @@ struct blk_flush_queue *blk_alloc_flush_queue(struct request_queue *q,
> if (!fq)
> goto fail;
>
> - spin_lock_init(&fq->mq_flush_lock);
> + lockdep_register_key(&fq->key);
> + spin_lock_init_key(&fq->mq_flush_lock, &fq->key);

What's wrong with:

spin_lock_init(&fq->wq_flush_lock);
lockdep_register_key(&fq->key);
lockdep_set_class(&fq->wq_flush_lock, &fq->key);

?