From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.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 0499236DA04 for ; Thu, 6 Aug 2026 16:59:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786035565; cv=none; b=IwXFQvSpQ3hk4AsEnzh5hEbZSPosIRzpopFaLnFpEP8Ib/OSXm1LwurUnhxFrF2jemOf0fdPa+jzetQ7UjczZ2DQTOo3hmS5tbimmtj5QrB4D1c+T5BZu+jh5Y45YDmTbJZg2M6QqQjT1zE0QuLPe1kHOsPsSw+G6blAw9vDW1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786035565; c=relaxed/simple; bh=kuaP2Ip3RQshQpbYi/ZOrxn5Jrkw64bBBtC+6NgGKu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/zVPCHiPQfy0Rjogt3yb2+OtmGHB3TywXaiTlddyiIDxuQLn1mKmQFuO6Gb+0C4T2iWvWyqcBEVmQqe04Pcl9r29qj5AHssgZR5SqSt8ZOaRRXOcdbGk5GtlpVaSvadjC0egT2Qxa1qCRoq7/33umLfFX6HJR82cSXrXglx1j8= 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=S/25BVFC; arc=none smtp.client-ip=209.85.221.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="S/25BVFC" Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-5c2dbaf828eso857883e0c.0 for ; Thu, 06 Aug 2026 09:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786035563; x=1786640363; 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=y4mp7C2u8iNxOV7vEnH4xyJiQARLq+7PYATgmrobvgA=; b=S/25BVFC4tQmExvrcnyrL4T+C1uYJLjrko+D058nwwfiFqQv5R4W5QwuMHJ3X5fpUc p4US9nxxhggMLbHAQQ3aGWJfVlACWXvwV1WGbhC3cFwRkG3KZM1sTvSqYadGrEFPNNWA Bj41weHqHIrica/WvG7zopeKK1gHUcXYJpPRtPm/Fg+IFrMytw81V5pgI6gc3iwIUJ2Y KyI2HDTHgjuQf+hnQ+zpKkfS+f0wYDaM01MNC7CAB2JgbgAfKUmMfvQ/nXZ5O00yIapR N3JE1Dh03CaAA2AlVwXwviKgBWMllrr8q9YavlsLMZA3ix9E2e2jJGAA/PHGfLuzPxbH HUHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786035563; x=1786640363; 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=y4mp7C2u8iNxOV7vEnH4xyJiQARLq+7PYATgmrobvgA=; b=Se4EXbk46DBvEo4lMBRd/l4kICXYs1a8ig9HraDDMiwflbeRhZzSpCJjSg1q9jbVNB fAGlp8XTb+pZmfuHyF5DCIEIBpbh8CzYenLPd9kniW1UsuwtHe+rwMR/I2jc8FSrnq2v 0YyryZIfX1MGc4mSctU/6XWazzYPmrLVY07TjbEfA1zkqRSdHPYJ6XkUZEnBohiTzW45 /oflGwsHY/6ljkngx9DsSUtsazs7Vlb0WlxfdfDJvtVgSPNP3NGH3hnX2mC2jWUkpNFV NDvV+Q5PWJB1vxjILZEWHapU0tu4Bxac1aODlk6B8CDG/KdVnpXlWO9G1WVoZ24npB6D CCTQ== X-Forwarded-Encrypted: i=1; AHgh+RrSY+RJjq1lrYRTaKqjTrrtF33poE8JfNwTdDZ+annFPgKuJLFkFTIck4TziTqeeo6xKSK7kkauw8j6mqk=@vger.kernel.org X-Gm-Message-State: AOJu0YzKZrXLCIBJpzD5hdjDa1ehhnEyhhG0aSq3cP0XwLl6DjvEla3f nnjoZDmxQSNXS+158Y3F2RycvdlevDoxaSaTTsjWsNe3SnUzq2nE9GlR X-Gm-Gg: AR+sD12fgI1kDTE37LZE9IhNRrGqzwHKd7iNkS49H8xm+q9954sFRZcP5GKwtDRpDtQ V9lIw1tNK6S7YiVZ8iOjh8MqvPWHMG5R5PKF7SYFCY0vB3NXJhqLkce0Q1IhuIPrsT5SYqIz9pj zJepXHRs5EvYbiJLKdtiKuJSltQQCPR98BtKsDkyP3lyQ2pyJwcWOwxMOO/+HDEQASc/nyxwLZo cu41d+aEFrliUlQtEvcTs8k9rPU4ae2oQ3ABBD5myjKpXkK/N15FYV8tTXKBmXO9keOd5DmWwHI 5kKr0HBqWszk2QbwbB4U8Q0heWINjqaL0v3NcwZ8BogZNsNFIKNZ1oFToXO/V0MapQs1hG96eDz Axud3Tp3ieEUP6oo7uzg7h+hKIGh6AQFTmuclElsNPJJgSqVQjuqqHYNtMfDylU6SWBnQXYs+9r Ffl8zycxOQApAxegyKMlQ2vwqPLIe3H3fSvLiLB4SDryJEV5EZgE5ETfVvjSc5lTKNN9GFnRGLR Nu48I0= X-Received: by 2002:a05:6122:8f88:b0:5bf:b3a0:388c with SMTP id 71dfb90a1353d-5c3d91849cemr2184457e0c.6.1786035562798; Thu, 06 Aug 2026 09:59:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 09:59:22 -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 06/21] buffer: discard BH_Write_EIO along with the rest of the buffer state Date: Thu, 6 Aug 2026 12:58:29 -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 discard_buffer() strips the state that describes where a buffer lives and what has happened to it, because after an invalidate none of it applies any more. BH_Write_EIO belongs in that set for the same reason: it describes a write of the data that is being thrown away. Leaving it set means a buffer_head reused for a different block starts life carrying somebody else's write error. Like the bforget() change, this is mostly theoretical today and becomes load bearing once the rest of the series makes BH_Write_EIO the report of a failed metadata write. Suggested-by: Jan Kara Acked-by: Weidong Zhu Signed-off-by: Chao Shi Reviewed-by: Jan Kara --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 381690479520..570ce7f495d3 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1518,7 +1518,7 @@ EXPORT_SYMBOL(folio_set_bh); /* Bits that are cleared during an invalidate */ #define BUFFER_FLAGS_DISCARD \ (1 << BH_Mapped | 1 << BH_New | 1 << BH_Req | \ - 1 << BH_Delay | 1 << BH_Unwritten) + 1 << BH_Delay | 1 << BH_Unwritten | 1 << BH_Write_EIO) static void discard_buffer(struct buffer_head * bh) { -- 2.43.0