Re: [PATCH v1 3/3] blk-mq: start to freeze queue just after setting dying

From: Bart Van Assche
Date: Fri Mar 17 2017 - 16:39:39 EST


On Sat, 2017-03-18 at 02:32 +0800, Ming Lei wrote:
> On Sat, Mar 18, 2017 at 1:32 AM, Bart Van Assche wrote:
> > + /*
> > + * Avoid that the updates of the queue flags and q_usage_counter
> > + * are reordered.
> > + */
> > + smp_wmb();
>
> atomic_inc_return() in blk_mq_freeze_queue_start() does imply a
> barrier(smp_mb()).

Hello Ming,

It's probably a good idea to mention that in a comment. The implementation
of blk_mq_freeze_queue_start() namely could be changed in the future such
that it uses another atomic operation that doesn't implicitly perform smp_mb().

Thanks,

Bart.