From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (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 0C85846A60A for ; Thu, 6 Aug 2026 16:59:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786035556; cv=none; b=myAcqzGuLzWgPhsiKiQmum2EIxz52OozlaFR13E+XEZLe2iIwXv6oyW7QKHtBdKd77HFPTNF9x6hyUs3jEnbs4ixf5RwAmhyaZ8t1ugo4g2YbXAxXxtGt8sG9wSDLu/h8Lcdx3idtX2QJYTLHeeB8gYdbS8uRGsFs7khYFS1oxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786035556; c=relaxed/simple; bh=5Z1GSiO2bc0sbRA3/0yuB6INnEL0uS+pxP2xPMYMvWY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O7Z0SvrJNV9Y0z5EE+XWI1OXIC6lWGzC1hkwCwMMDQmZ2VbFd4BgyQbTjkfPSgErWC8swc9mradHRI0u1zYrlDQ/ljk8/m/+37lVibJ6hdEwh59n2e1VLEnaPqx9o+EaeFtnFCC68EAgXYzsNdBj4udCkKZAmS/04WwofQpGSog= 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=qk37Wmp/; arc=none smtp.client-ip=209.85.221.172 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="qk37Wmp/" Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-5bf959b820cso1630880e0c.3 for ; Thu, 06 Aug 2026 09:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786035554; x=1786640354; 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=Ft6ziQssPBfawpI3vOIh0QGxtSEYHeudqaZ7dvpKRmU=; b=qk37Wmp/CtD/1kafq+OBtkVnhWi4T9bibGAL69z78ETPBUq2jUUdtCmYmR9EGWeIkV QA7wAo8NWiYw+DjG+w6Fc3StZRMLlswI6mjhyr1Z586dr69ff56iqFH7+BcHrVDNNQ9l 9OohvovEjMUDchjHqe+AIAQYrpGE2LVban+ffN/loaZ/82ZrvyClcLer5BFWkbgZO5u6 aeJENLErJTWzQpFbkUqWi7zZnacELJv6m/hc3UMcivc6n/WGLLkhBjZS4pssx0lwakkK hxjc1/QOl0yuqP+BeB68Fa6JeN1PL8XuhfQ1aR7/dGLcdpG1C2sLjBu/IsBGiJlcOcTl YmeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786035554; x=1786640354; 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=Ft6ziQssPBfawpI3vOIh0QGxtSEYHeudqaZ7dvpKRmU=; b=Cxx0yP7nyYyGNEonGCkwUP8yV5Gv+9IjqvqKeTWeAsBlpoVwMg0Q8Lu4Wo0UkTTgyn K1josU0FpaWpU4qQbMj0l0TGfE1LRw1sUWQHs1CjmtRduhxN6fpY/rovyulIfXZBl9mB OFtyCv0IiOxHNiNxmOno9hauAyINTI971VZJXOFvVIAdvTNZoBWBNC8HZZr+U2uvVGT9 kb293ZMJOwqbjZgMqjU5U4trb1t9Cqd2dTzoxiaouQ/N/9sRjl57hcsRdF82kn0Obf9R RjN1Ywy7Beyee05ztDG0vM2mnKRC6ZK+najr2HSTDafG6R79PJYiGyOinEmw85Nfc1YL Pfkg== X-Forwarded-Encrypted: i=1; AHgh+Rr4hKCMvChhdARxYNiBCzU7SMty0jvduVM5ELoonlEpFUfjSV44nm6jl0LABLcv3OXt6ATozCo+BAqmYZQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxe/efAdLhTFuuDKTGX/ChIyP+yFc14yA3sFXTnIdepRXyEjgTn 4eHNqjl8/wVl4jsA2MD1AQ4xX3w8XVh/RKh5g5DWbvf5Vg40WCsXMOJR X-Gm-Gg: AR+sD101ulFZmmEBHEO97E4SQ/Y3SjG8haCI9YkHcujPBL8h2aewy1ONPFMTBD/2zhZ Ytk3Taf1Sp+zztR06ytxqeJGR+8raZOZ8kU795Wzm9fIfuoSG8B8da+GxzxB4oayITZVKdrbC+O cY2ALqfB/5cEwBj+BTaKk4IE2EpyM+rEHrah121UCpXnNR9MZbRp97Q9WzaXBxmr58U+ew2VheJ fmfEeJBjTQKi+FbVhqnD4r2Y48oaNVJDb1+2j8nSMyLwN3XhISJV6fXykZ6avVyr8bwCrQTHFmg TMtK+jxCDXdkM/Xkz1AyzyDQIQU3pERY1xy1oTtp3P1rfJKVo0mrJKOuIFpGff1Wz3MU96W8C2P zbeioS1ML28sQgwBlJGrWEoCQgobIuhgiUPcHhzQunpWgd6wXraDl256pF3pqButwcz0W7jFyMs xZ95Man1WZ2DbXGkft1alhziHd1feVkcIxQLKF7hJtmkC+UvozuPQpwoD1EiaX0RVnE5NRq+FPx zzXNQE= X-Received: by 2002:a05:6122:1c85:b0:5bd:8c84:59aa with SMTP id 71dfb90a1353d-5c3d9162e78mr2479549e0c.8.1786035553890; Thu, 06 Aug 2026 09:59:13 -0700 (PDT) Received: from syssplab.cs.fiu.edu (nat1.cs.fiu.edu. [131.94.134.89]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c3d05c594fsm3706321e0c.8.2026.08.06.09.59.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 09:59:13 -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 , 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-kernel@vger.kernel.org, Chao Shi , Weidong Zhu Subject: [PATCH v2 05/21] buffer: clear BH_Write_EIO when a buffer is forgotten Date: Thu, 6 Aug 2026 12:58:28 -0400 Message-ID: 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 written again, but a filesystem freeing a metadata block never writes 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 Acked-by: Weidong Zhu Signed-off-by: Chao Shi Reviewed-by: Jan Kara --- fs/buffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/buffer.c b/fs/buffer.c index 2851830995d8..381690479520 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