From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) (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 1B16847AF49 for ; Thu, 6 Aug 2026 16:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786035594; cv=none; b=a2nzvCPHHTzUmC8dhk0DDNS3JalAMKTfxHBH+1zPPLaZpLpjNGB2oMAl926dfppj8bgh8fR0c6xf3KB5mLZSQV1sE7YhI6e6rBiZcj/8hY+d70lzz4JoxNGLg8asMNJBTtXDlz14pmNQq+mauEYS49D0IwHvOp/JrsNQBVAv7n8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786035594; c=relaxed/simple; bh=3V2E2gAPInTwE0n7u+WtHxKrTSKd6q7DUDLR8AMb2Ys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uPipGyXZj42g7pwtmtlH0y/+Y1SXKiBEwL1DGpvi3i/VC4NpPa7HmjvpkA/gErUDloC6I+60r4B2XLvddqZLIjFiEZ0Jk4oiNg9931idwnQxxamT61KVzz2afCD9+DiEPFd7WaouzVk4niTCxWuXPwN6MAivdtiWhqZOIqm8oEI= 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=TuaoA23D; arc=none smtp.client-ip=209.85.221.181 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="TuaoA23D" Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-5c27e38ee18so1234073e0c.1 for ; Thu, 06 Aug 2026 09:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786035592; x=1786640392; 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=V2GNnxLBSrWkOcqqCLfBVyKRdpTurr41NHkw8NmYzAw=; b=TuaoA23D0SdIAExb4Gehe+KsbZn2uo5RY+BP4Q0vGRgX2ExuLN67k9MgXIkX1r40DF l+yWKpUCpjw12MnLTpVkWD8dNuH/Q3vlfk/wIL4EfzRid43guZxQDEP+YZH+RPzoPX/0 QPDLW40xqJaExMdwGlKGE4iCXAYD515+z9F3Xt/IO7wm/swnP3OcIh1j466KAgChJ9dq TXfOrTBav1JB+Zpr/FL0hM198idL7VRMhpHHNPQJoZQgWR5AoDdZ0FM6UHQ4vqm0dDjd sCzgQQdEneikW6jmq2UtuosRVwX293K1IYVfVGDvIarGLBMTdIpkXBzdouquMW/f35xS Qhiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786035592; x=1786640392; 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=V2GNnxLBSrWkOcqqCLfBVyKRdpTurr41NHkw8NmYzAw=; b=PsUG26Co/tqbFDwdacxdIJLpOHce40gdztWaTJ88UPZQShOg1Bwp6vmIgFL3fPG64c Zyw0X9620UzCTb568Gr6CuYnylHM4hXYDPcH6lN6nngz9M3f/I/yWqAQgygJNMMjaJSs gSBH5a6hLPRKMZzNfPyFgIdrUh8zu1MZOEdN654GIttd48rdz7oEA6qr9fWw4dZwMqgc h1eYVr1rKIKG5d8Q2izXv0OT5PABGXNmglDDhK5wfER877Oc+5M+iPtX0uGglnRn7qzy V9plU7qzswkWHPeoHZOa0Ee0opgYllzUH5TDzKu94ci1dPRYHpBezppkgQ0Cg2HbAIXE o87A== X-Forwarded-Encrypted: i=1; AHgh+Rqr5DvU8bFsVNkymDdOBo6ns7G4frpSplzNicVGQRxL7sW4ItV6JCG+D81wAvo1JGCkXoiq/jgl6t6oj0M=@vger.kernel.org X-Gm-Message-State: AOJu0Yzg/j1ve9SJ53+BtCteWOPnvkOZcAUcw2UeWx/zA/9izH7xAR3E 2FbV6856S2ZhkH15RE44afNcBSG6nVLQ9vOZPuJhkV5E+pHAbQfVbv9x X-Gm-Gg: AR+sD103b2zXashFI+PmNNpBOb9yAmpw2epaQN+OFnV39buz4+6XLVE07wS2IOciXJU GXITMs6o758NETJ+koLTxKGhW98Gc6hx3HFCHhU1cS2XniLi/bXxXMtLxw3kavZPoCehryCudKr RBuWxDVHsVEedAUfmys1b3OIiQWA/eVPc0C80PM6u0X4+CSQJBOcyr5RU8jJL/YWEdTO5Asf22L h+drIDMUm9D5lG99YPEhrvzSz8gmiL9KxVz81jHPWFgIRU4R9HWh7IW6MMHwXmtcfmyPBl64Qde mKXUi4AzXtPy+5pPjMTgYOlpY0O7PkIfMLAoims1cJ5/VNX6KMbU946n/MHcB58Ql1y3Ce9lZ4c 99kcOXPhoGaVm/A6UWph3Aiy+sjxXmeETNOMEciAl7v8irZjDqgPLgcC9EQ+6azbN5Kal5BVdjf Qqwd3ddaD/4NdnNBswXsiY8uXqpaZO9mUIH2sQ02QUkTMpEyh0DM16+lLIv4SEZEieOCyu8gxHu ULhTVKtG0SgjY7NUQ== X-Received: by 2002:a05:6122:179f:b0:5c3:367c:c001 with SMTP id 71dfb90a1353d-5c3d923fa4bmr2401901e0c.12.1786035592033; Thu, 06 Aug 2026 09:59:52 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 09:59:51 -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 12/21] fat: check for a metadata write error with buffer_write_io_error() Date: Thu, 6 Aug 2026 12:58:35 -0400 Message-ID: <4b6019b5a48b83c8235918b084248983a57692e1.1785951556.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 fat_sync_bhs() waits for the writes it issued and then tests !buffer_uptodate() to find the ones that failed. That relies on the write completion handler clearing BH_Uptodate on error, which this series removes: a buffer whose write failed still holds the data the filesystem asked to be written, so declaring it not up to date is wrong and makes callers re-read it. Test BH_Write_EIO, which is what the completion handler sets and what this code actually wants to know. No behaviour change today - a failed write sets BH_Write_EIO and clears BH_Uptodate together. It stops being a no-op at the end of the series, where the new test is the one that still works. Acked-by: Weidong Zhu Signed-off-by: Chao Shi --- fs/fat/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fat/misc.c b/fs/fat/misc.c index be18f6b5819b..4a4cd0111e47 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c @@ -356,7 +356,7 @@ int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs) for (i = 0; i < nr_bhs; i++) { wait_on_buffer(bhs[i]); - if (!err && !buffer_uptodate(bhs[i])) + if (!err && buffer_write_io_error(bhs[i])) err = -EIO; } return err; -- 2.43.0