From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (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 A4B713921DB for ; Sat, 1 Aug 2026 22:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785621681; cv=none; b=Z0cKiHo63brCHD+UHGBggxR51TH2CXB6VGd5AACy6gLRF2rxcyV36a/FXTz6y60CCnPm5H6RRVBoT2lAY6DWfGRfjPPmhVs8kBmWgpFJ7JvkDT2QSPbxfTbX2OAANyyt60R4xzPF9H1mgIJ2ZwoKIkWx1L9hiyBaSL3GYjo9MEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785621681; c=relaxed/simple; bh=0vTXRoH3hdLZk9GtOk2DqiSHrzqM0Eca0oDK4MAlmLs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=trWPw4MqdCWJ8h2B0IaXzkf14Jmf/maPwyxdWcv4Z+3M3VmNFAm/lkSokibYsAOd4lM4hIBjLYI2wUHre8eo7VcPMc0SgucNkLD1ww2Kuj48Uhkx2AZa2DW1GZ+9SM2eo8R1YxnCYCznxeU1RhYIsBA4PJKBRETZirqSe2pYF5w= 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=pY4wVshl; arc=none smtp.client-ip=209.85.128.170 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="pY4wVshl" Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-81fc442789cso32953447b3.3 for ; Sat, 01 Aug 2026 15:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785621674; x=1786226474; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TKbaZIzhd+ZroWBcz7LzJbdFmiCbzToVe0S18iQ99Z0=; b=pY4wVshlZkkdWFCJqjaJcVP/epbFWkKWUHRSyLSN4aI7i1IyFUJv8sjGg7c6/tPv86 guMwyMDTwjrkhLZe1bY/StOX4aP2nkbWZEHe4XLU5MbsL5xqaiBx76A/sMlSwEbQldXG UX7+7TWBBf65gTlD1T+o1br2ChtsVUtTCuql22cWoyFIhFD5yr2J+4LOenoXvqXVigQ/ rT8iqYsLovFCn8j4oU9+nyw0gqmxTnBBbFMnDsOM2OSdellEjlNAwWben7kHwxqjrBWz G1WHdtfXl2UaU9du7/odkYLaYA40hWc7a8e1gAvieG47ybUuLgs/TaNXXzkC1XJIX7FM 65yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785621674; x=1786226474; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TKbaZIzhd+ZroWBcz7LzJbdFmiCbzToVe0S18iQ99Z0=; b=UNVMSspIjWcXHbBaousihw5bjDYifydXhYziwewNdEY3Tl2LjLIRAhcTAp7r+9vl7b saosNBJAS8FFDvSsCSWrWnUKCJZJZhoNEk0hyIUneK3biOtl25EBgsgrEiFtjnRNRWQL 0r/3JJ6OpSaBaKNI6i9XfkpAg2/HHs8Qy3tGEpz2qVICQiuDKfda5QIFGJXz1EKSezOQ ZIjc5JgP2Afv3TahwzEOmU72B+iMeYtCs3vG3IW9AM3NJdhk+o4oO3Yr0SS2NEQasPdT P8Wa0kC4W4NfO8HLxxeiEs5jZGwuTQJAYHrIXt0YZ/qhC5xTRcfeA9UG6tH3iQzSnesi aetw== X-Forwarded-Encrypted: i=1; AHgh+Ro5SlWnlzcAut9fsKqMi1D+IpdRRYR2Ydbmz8XqGGJeC6RkH1nCkLc+QeXg350+ek05IKw7YXd0sAcI6oY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1vSPvY2zxRFxkVmp3MYxmcG7EF54zeqSserKcbu7StNyMxAu/ OmFUXFZ6Wp1J3RAGOXhjd67iE9ZlXdWwx/tp1W96A5mYRkosxqIt5A8A X-Gm-Gg: AR+sD10OI3ReK0hx9u0R15y+ghhabdFY+wYJDhklnoFnFnyoZ2DHl0y5SVGCZBTTyKj M82OQGpaNmtHJ7qTX1B4Akcub9FHOM/XHxxC5f6AKEHAL71uOsOm7UyHqQZyFXpgFc+FNouOhgb kuv7bN9CNfyHyCAcjmfVjW1IUNGfvKqK877mA/SejkM1NNXit8rUYPdnXehzf04e/qOT5TNN8We KMxAIHJQaUL24gOzzaB43q24z4OkxynMma3yGuPl/KGZObRR3BLyefStOxh70kDAex2bYhFivbp rvdmi8lyj2865pAj2G3QSnasqCvkdqnH6qROHrvPwbkmLTytEgIRnh9s8B38AQhkjtVgRi7vHIH if/WNWA6dzt8uhKTzfUeYLPTbfSyAomra38ZuTOlAlJZhiBjaXWavEraMbSkd8Jv6r1LNMx46al M0lZNy2J9Zr0khOlceOR/OBIFqvN7SASsQ9sfS2sYPGWKcOuoP9PKXne4TbcivtcnabSqkVQ05i ig8kxc= X-Received: by 2002:a05:690c:dc2:b0:81e:c7d2:f26 with SMTP id 00721157ae682-81fd49cae43mr67970467b3.6.1785621673554; Sat, 01 Aug 2026 15:01:13 -0700 (PDT) Received: from syssplab.cs.fiu.edu (nat1.cs.fiu.edu. [131.94.134.89]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81fcd0d6fbbsm29903767b3.25.2026.08.01.15.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2026 15:01:12 -0700 (PDT) From: Chao Shi To: Jan Kara , Christian Brauner , Alexander Viro , Matthew Wilcox , linux-fsdevel@vger.kernel.org Cc: Theodore Ts'o , Andreas Dilger , Baokun Li , Ojaswin Mujoo , Ritesh Harjani , Zhang Yi , Bob Copeland , Namjae Jeon , Sungjong Seo , Yuezhang Mo , OGAWA Hirofumi , Mark Fasheh , Joel Becker , Joseph Qi , Andreas Gruenbacher , linux-ext4@vger.kernel.org, ocfs2-devel@lists.linux.dev, gfs2@lists.linux.dev, linux-karma-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Shi Subject: [PATCH 04/19] buffer: clear BH_Write_EIO when a buffer is forgotten Date: Sat, 1 Aug 2026 18:00:48 -0400 Message-ID: <1bf058fd5867bceeede78d99844b49a26ed6f3c5.1785621505.git.coshi036@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BH_Write_EIO records that the last write of this buffer failed. It is cleared when the buffer is submitted for write again - see the test_set_buffer_req() check in __bh_submit() - but a filesystem freeing a metadata block never submits it again. It calls bforget() and hands the block back to the allocator, so the flag outlives the block it refers to. That does not matter much today, because the write error is also recorded by clearing BH_Uptodate and the buffer is discarded soon after. It starts to matter in the rest of this series, which stops clearing BH_Uptodate on write error and makes BH_Write_EIO the way a failed metadata write is reported. bforget() is where a filesystem says it no longer cares about this buffer's contents, so clear the error there alongside the dirty flag. Suggested-by: Jan Kara Signed-off-by: Chao Shi --- fs/buffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/buffer.c b/fs/buffer.c index 04fcc34e4fa6..7889c30d8715 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1091,6 +1091,7 @@ EXPORT_SYMBOL(__brelse); void __bforget(struct buffer_head *bh) { clear_buffer_dirty(bh); + clear_buffer_write_io_error(bh); remove_assoc_queue(bh); __brelse(bh); } -- 2.43.0