From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B89F63B774D for ; Wed, 8 Jul 2026 05:11:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783487480; cv=none; b=m5+/NqK3iXq7A8uzSorjo8MI+Pz5V25Bvg3G7e3CTGm5814QwEMkNzCNKGQah7DdYElDWrMOZ4TOcV4OK+JjDy6M4Af5MasiBy0T/mSW2mJlZhp4PhpDxr/jCR8rKXoywR0mHXH4YNAqhOrXqdCdzZXWhNMcS72FWFAfVhMHArM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783487480; c=relaxed/simple; bh=vv8D2L8doGz9gEj6yEEeTzBs9V+HoojsKpK8bM9rlDA=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=URncUO4+8DgOUuPTWsVWSIkJaCdLuSNw00er870E80/FYt+mG3TEDBMVh9oY5E/q/zoHOxkXmoqOLmUv6JaU17Tq0w6l8t3qF8NkGoQK5MKu7ijrelXx9SnIBTb/TxgBwDIwphcqsRrKNXAyokHfAoIJzkI1bMGT+CzlUyeL944= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=W+WALtvV; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="W+WALtvV" Message-ID: <841e91db-a51e-4df5-8cfc-e3762a2fecf1@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783487460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MDTp1TcEqFpY3yW2LIhbxzhg7yVVaR/dVnLK5C8kfJ4=; b=W+WALtvVlrpL5xZ7l7B9MC6i9lku2jsnrRksapy3ZMZPwgQmwzlFOi2jpx0C8kUfcWn1vz z0yTIvs3NMVUmGwaJyUf12Zicjr7lKPoVOCjDY2niqR5jJrV9SVkCzd93ExHu0QB5EzfXr Nhyc15Hk966xmt2skeqFc5YE6/WCs4U= Date: Wed, 8 Jul 2026 13:10:47 +0800 Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Cc: cui.tao@linux.dev, Yu Kuai , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Guopeng Zhang Subject: Re: [PATCH] blk-cgroup: clear blkg->pd[] with WRITE_ONCE() in blkcg_deactivate_policy() To: Guopeng Zhang , Tejun Heo , Josef Bacik , Jens Axboe References: <20260707125814.1978139-1-guopeng.zhang@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Cui In-Reply-To: <20260707125814.1978139-1-guopeng.zhang@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2026/7/7 20:58, Guopeng Zhang 写道: > From: Guopeng Zhang > > blkcg_activate_policy() installs blkg->pd[] entries with WRITE_ONCE() > and also uses WRITE_ONCE() when clearing them on its error path. > blkg_to_pd() is used by RCU readers and reads the same array with > READ_ONCE(). > > blkcg_deactivate_policy() clears the entry with a plain store. Use > WRITE_ONCE() there as well. > > Fixes: 56cc24f59c14 ("blk-cgroup: don't nest queue_lock under rcu in blkcg_print_blkgs()") > Signed-off-by: Guopeng Zhang > --- > block/blk-cgroup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c > index d2a1f5903f24..a1dd69f99f5c 100644 > --- a/block/blk-cgroup.c > +++ b/block/blk-cgroup.c > @@ -1691,7 +1691,7 @@ void blkcg_deactivate_policy(struct gendisk *disk, > if (blkg->pd[pol->plid]->online && pol->pd_offline_fn) > pol->pd_offline_fn(blkg->pd[pol->plid]); > pol->pd_free_fn(blkg->pd[pol->plid]); > - blkg->pd[pol->plid] = NULL; > + WRITE_ONCE(blkg->pd[pol->plid], NULL); > } > spin_unlock(&blkcg->lock); > } Reviewed-by: Tao Cui