Re: [PATCH 2/2] blkcg: init root blkcg_gq under lock

From: Tejun Heo
Date: Thu Apr 26 2018 - 15:18:58 EST


Hello,

On Thu, Apr 19, 2018 at 12:06:09PM +0800, Jiang Biao wrote:
> The initializing of q->root_blkg is currently outside of queue lock
> and rcu, so the blkg may be destroied before the initializing, which
> may cause dangling/null references. On the other side, the destroys
> of blkg are protected by queue lock or rcu. Put the initializing
> inside the queue lock and rcu to make it safer.

Hmm... I can't think of a scenario where the above could happen. The
queue is still being initialized and no one else has access to it, so
I can't see how it could be destroyed. Can you please describe the
sequence of events? Have you actually observed this happening?

Thanks.

--
tejun