From nobody Sun Feb 8 14:22:07 2026 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FBE73A7DE0 for ; Thu, 15 Jan 2026 14:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768487919; cv=none; b=D93niVE6ne5aazrxGy592EXREXAMyNa9X/Vx2+Tcu9vGGJ7xLdNMURNBgjHKCjU5zVbZofLrZZySiIPcgC9K9nJeP+MlriXfb55CO/Bn3g180fapMgjrarnSBkXDJY0u/WRWz4exs8UZf69y19C7u64u5A+5oynKzbL0kUlYcfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768487919; c=relaxed/simple; bh=Wv/3Aa8tWfJjLLISVQDBUFQsifWFbeQ/XDhV5lhBn2c=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=sbJ9QN8UOrVgb7YEGN7AM/raVqOZ90EseWIDg6DMAOOfS8uGgN/jxZk1XzYHgXcOvZp1wPS6GEa2UVUWiO5zOhvGrR1siGUsTzAx40yp5kUNvd2vtD2sda9GCiZQt3qd8CP2/BgbFQH82ZldpPVQeukmOSHkWLGXurMTvwV9ULI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XwCAw4xW; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XwCAw4xW" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-45c758f516dso579223b6e.2 for ; Thu, 15 Jan 2026 06:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768487910; x=1769092710; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6dwhaqBfxx37jZyPctpV6PBwRbKadr98aK/ySF7sB/Y=; b=XwCAw4xWPQPR2oALpqh5rtmivwnL6RomRAzYjDFfdz5jjXdPN5syvUoJ2kw06l49Xj mSDOhUxxEeOiaivQSzTapmVWcr2VqwYeaIRE/KYOOTO8HaO03e5ORgYwEY/k28RMUnkz jwTw6Ii72BiJH+UIxbTgaSVoHwPdKs1UrkVi+RVMKMEs17RBnM1Rp51S04Y3LLdrdJHW kT9a6MhESAn/9B4+Ge/dlxQ6KjT/IIQBcJYoCLIkw0G25xd198EHuqSnsh33wU5mw10F wzAGTX1f7NPdgQW3efzE5eekaBrGksQmVobbAbinH5JgHvH7pP/Xi7PiJwxcyH7mGMr9 mVZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768487910; x=1769092710; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6dwhaqBfxx37jZyPctpV6PBwRbKadr98aK/ySF7sB/Y=; b=JgFOeTicyfKcOlU87BsdHhUSZIxAKIosFYVlKHKOhtVH3c4rzKAKnEnUm7TRVnFrBs ltkf4LF9ICXmNDolvIaDFkeipQKMg8oOKF3MFKFTgUGpbEKSRTa22LlGQ0y+d1nfMT4T qsTrUGOPb3miE5CtODLiGgA/CdDraSLI/g81OiHBQydmydSU69hVg3/S/UWfLaEvZ+M1 sDwco29RzEh/K1iASFYqXgVtZOU42cO3VdzoGXNJTjdOMf1AlagvT9spAGN6A1q/EUO+ VW7RxH7RNdUpGSB+DVZnHgepl87Yyh1UyxkqJjaWIVso11YMxLmMS3r83IVZyknUSYUy ADXA== X-Forwarded-Encrypted: i=1; AJvYcCW7/2nPJ0hxDTCVapogs9s/BAauEHj9dmmuZawfaml+/ZjA74KgKP/U1BTVaIgTMYmUwjt78nDTvBtQgJY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6fBqpoBl8LsUHoqYDcTQPorjbtG72WVIayqJQgtRqUrdMhzlC UKeGAHjGGqRGqllO71PFp6ZYAqunU2nwV2+8+KMnO6bo4pATqh+0XZYV X-Gm-Gg: AY/fxX5uL1sVnsnM2fTdMBSAEiljxK8ZnY4NGJRXwaP1SRDky2L6AQFQsEzuf3swWi6 jeLLQiv5QolVLj0QtOz5i0cugUGuM8MKfByXP8qDEl7Dk6QbYk6qryP7YiNW47Vbxm5eql2pNWf YxikSIxvgsv0VRHOPuhFoDVBgoukLK9N2OjEUBpG+MReWM6HyODWyN2Zs2RzYzFjtx93k1Kk8se NuDoIpFccLcYrqFtNwA1NjzlMDoeXygABE/1S7YncbqekXY36kogZLiDZ4iye8Hzy+R6b1jUb4j nKe2nlalorkbGdc+sImowMp6+zr78VR6RvPuEuBzbBKf+L7zGzwUFNzcVfvjHVLHlnmp5kCH/hC C0u5Kd8e0rhqNe/fz6tMMpGI28+CqMmitcPHBS0kf4NoX2bsydEwA5R6dTBtF+hI9bl0nZ+Qaob zKo82mwnSUNwfBCY1E7klZ8whchZHaMwXU X-Received: by 2002:a05:6808:c2d2:b0:459:b564:dd64 with SMTP id 5614622812f47-45c715cab7bmr4382306b6e.61.1768487909769; Thu, 15 Jan 2026 06:38:29 -0800 (PST) Received: from newman.cs.purdue.edu ([128.10.127.250]) by smtp.gmail.com with ESMTPSA id 5614622812f47-45c91352ac3sm449897b6e.19.2026.01.15.06.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 06:38:29 -0800 (PST) From: Jiasheng Jiang To: Chris Mason , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jiasheng Jiang Subject: [PATCH] btrfs: remove unnecessary RCU protection in clear_incompat_bg_bits Date: Thu, 15 Jan 2026 14:38:26 +0000 Message-Id: <20260115143826.17725-1-jiashengjiangcool@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The function clear_incompat_bg_bits() currently uses list_for_each_entry_rcu() to iterate over the fs_info->space_info list. However, inside the loop, it calls down_read(&sinfo->groups_sem). Since down_read() is a blocking operation that can sleep, calling it inside an implied RCU read-side critical section is illegal and can trigger "scheduling while atomic" errors or lockdep warnings. As established in commit 728049050012 ("btrfs: kill the RCU protection for fs_info->space_info"), the space_info list is initialized upon mount and destroyed during unmount. It does not change during the runtime of the filesystem, making RCU protection unnecessary. Fix this by switching to the standard list_for_each_entry() iterator, which safely allows blocking operations like semaphore acquisition within the loop. Signed-off-by: Jiasheng Jiang --- fs/btrfs/block-group.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 08b14449fabe..d2cb26f130eb 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1011,7 +1011,7 @@ static void clear_incompat_bg_bits(struct btrfs_fs_in= fo *fs_info, u64 flags) struct list_head *head =3D &fs_info->space_info; struct btrfs_space_info *sinfo; =20 - list_for_each_entry_rcu(sinfo, head, list) { + list_for_each_entry(sinfo, head, list) { down_read(&sinfo->groups_sem); if (!list_empty(&sinfo->block_groups[BTRFS_RAID_RAID5])) found_raid56 =3D true; --=20 2.25.1