From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 A1022384CCA for ; Sat, 1 Aug 2026 22:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785621694; cv=none; b=C2OBd76o3OxMNGb/oEHK19MOtnrRZRaSITabERicfIapkzvhdowlj+rCrh4luuQW9OGq1lHrlNSI+Kw9tk4xa7DSOI08KED2as4c/2wdkq+yvMrmJYh27AP4sEO4a0Xoj2dvQNm0TddhBgqggjVM6QRkkvvV+HctRIy1m5UMdu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785621694; c=relaxed/simple; bh=3dsw1Zg8M5wNaCMh6F9jO6eXBuRivbQ5EiuJWZtmA2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EyAKJ0RWkOftR0nJvOjnuJSEgQujBjJzISwFlfgeESJ34C+RyDi8RzbQ4zfUOs/BCSfFLxJ4mLnsQ7d1ZeGdVYfT3zvl6IgvWK/bqjGbjvgCQIl/qf2NiiJOrgjplqjZMuKBbwS2KCA1OZS4HFcvKf3FIjIKGKQ8DR7PzJfDbAI= 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=jIdtbZ4O; arc=none smtp.client-ip=209.85.128.175 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="jIdtbZ4O" Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-81ee41aaec1so29633547b3.3 for ; Sat, 01 Aug 2026 15:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785621688; x=1786226488; 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=/DniCfidRbKUpj3g8JSrdbI5dITb8OPbOoquygm/08o=; b=jIdtbZ4OTSOT9OPvleuuFCF4Pc38X/ywxPMR3t6kTu5fvOjwuri3CWPIDleEi+yfTd jNjRjG1uU4gjKFa4m0dUa1vBYSNz1jrwx9qJTMdLMx1EQ3UYJ51GPPdgyzjVvOtevzmt 6UJhx2S1iWnz8BdBXkdKGdi1lb50HfS7boV7941Auh/IIbrBTOMNuSWbz5dE+aJOW+oG oKyznNI4+kb4B9WfmRt889vBo+GzDT5Ek5Zir6iOX8xJagkbiHQXlNFQdfgLJasR8FYK rTJsM/7wbLfAdvPU48ELbaRQt4tD+UVBk+43/CEbnMJyjdHZVFOh8PsqlwzZWdXFXgph F0Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785621688; x=1786226488; 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=/DniCfidRbKUpj3g8JSrdbI5dITb8OPbOoquygm/08o=; b=E59Woh359JFNGbo5LP3CpNfjYGoDSCcKm3jN/iD3BJDcI4JNEiM+G860zCOEDTSq1q hpaynSF8TenRr2BKT8UHTVfAOJ49TKh48PlYXA/uY+caxan/XHsAIEaOCJptt6poutUF Lh+ASXuC/I/O1k3dpWtoKfqkMnKEXK9t0MkJFMpTkB1+VF4l5nB87IKjIW5cdRmgP5KI 9yegrs/J61QTMG+N0ATYQ/37C93739yZRdRBt64UcOQZjqmxk83TFPA+ztbOxWx5xDtS l61gZM3dD3Lp/PFQTzhjecs2qKVRhrNVy2HUaug3n9Dlq0aOPXGG+Dmf/v20jYZouXA2 2f8g== X-Forwarded-Encrypted: i=1; AHgh+RqThp1BL+ngkuDdFTWbYbf4OCTnHEbEovaViWq8YCWJLQLVh6cNK4+mlk24EZuRR7XWHGagmRxuDPXMXHU=@vger.kernel.org X-Gm-Message-State: AOJu0YxWWtqgwFlrz37/zVVRMnc0IWMnwnh/DDnmimEd868l978SpxMu N8prVKU3n9UJ0o7RXwXWX1qA9Bn2EHR4/tY7tr++exMGgiuAvQtWQb+Q X-Gm-Gg: AR+sD10FMeck/KDx3qzITr61v/jSNHOMWS2NSMXgj7tK2OIfCuDIIFRTN3SXB0pgn7P YopzGX2ytUcOSuUiUAPAQer8b0Jh7h8yoUpbxcVZ9jau46nXKMGtrjtau9z7fhlAqUwAxUesS+o u7tEyuWa/nXJhymwCjfsMGxArLYzzc6pJRS92L4v8b6bTpNwcaVvfY380edTqCgsdcQvDEU2JiS 7H8tlSIpEpkWdd/SU+D53j1OBF7mLrSW56U9Nlku9sm5u8RisQDp/DUdnlFGpyfW7v84jcpqCYg Cpijv4ahS5iwxiio9sW40KC/WvyrnlXc9S2M5WF/lHq0HiNELJ81wPPpxpCwmhzOZJ5weQOf59w WXnjRaS/78Sv7/FhqnqKqbU2NhV508ZrGG56dtCn2b/45FyO+rm/klauoLoZ1Qwgfvw7ZGaG4Wr TrTch2I6S/DpbDc9SpvBKbgmo3YGZE143l/oMQzozUFz6r7GKVwVeyzOUZZHkTcsuw57FJBFtoL GHJlh8= X-Received: by 2002:a05:690c:c15:b0:809:6b62:2f7a with SMTP id 00721157ae682-81fd4b72864mr76660857b3.21.1785621688522; Sat, 01 Aug 2026 15:01:28 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2026 15:01:28 -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 13/19] ocfs2: check for a metadata write error with buffer_write_io_error() Date: Sat, 1 Aug 2026 18:00:57 -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 ocfs2_write_block() and ocfs2_write_super_or_backup() detect a failed write by looking at BH_Uptodate afterwards. 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 instead. Note that ocfs2_write_block()'s test is the positive one, so the sense has to be inverted rather than the flag simply swapped. The comment in ocfs2_write_block()'s error arm needs updating for the same reason. It said the clustered uptodate information did not have to be removed because the buffer was not marked locally uptodate; after this series it is, so the reason no longer holds. Not advertising the block to the cluster is still the right thing to do - the data is in memory but not on disk - so only the justification changes, not the behaviour. 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. Signed-off-by: Chao Shi --- fs/ocfs2/buffer_head_io.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index 7bfe377af2df..733ceda79ca1 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c @@ -66,12 +66,14 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, wait_on_buffer(bh); - if (buffer_uptodate(bh)) { + if (!buffer_write_io_error(bh)) { ocfs2_set_buffer_uptodate(ci, bh); } else { - /* We don't need to remove the clustered uptodate - * information for this bh as it's not marked locally - * uptodate. */ + /* + * The buffer still holds what we tried to write, but it did + * not reach the disk, so don't advertise it to the cluster + * as up to date. + */ ret = -EIO; mlog_errno(ret); } @@ -446,7 +448,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb, wait_on_buffer(bh); - if (!buffer_uptodate(bh)) { + if (buffer_write_io_error(bh)) { ret = -EIO; mlog_errno(ret); } -- 2.43.0