From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (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 E2A453D3321 for ; Sat, 1 Aug 2026 22:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785621697; cv=none; b=R2ikDLTl8dlfJxp7ZXAOlKGE5WlliVg+5kzUb9ejGTjAUZ9KELfOqfpl7KVCIsUlx4cMLRGu86DLt8Z1ZpkLSJ1CSRly+pFdDXUCeHW8iL0m+ZpAPEaE/YDviNgiK92CdcZR5sLhtcdur9FDJ/kwiicYymNY4vKTUMEXgQxUZ3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785621697; c=relaxed/simple; bh=11/QTy2yfnrD1wjLL3sT4kKYG83gGCLz7L/Upg/VVro=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oKD6P+9smg3co/9QZQfP34Q7LluFG1bRe/lKchIwYwRkc8z6TxcVEb3rM7uR3aZzaMr01te25APFfDRIop73ndcvycwg1WxIOKAhEFbKxmV7xrLfXuyPt1rCOQSm3nGKVjxh+A5d54+55ekgDK6gvJriDlswSrRSN5uv9Nuz548= 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=gJRresyN; arc=none smtp.client-ip=209.85.128.182 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="gJRresyN" Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-8114a4542b2so33657727b3.1 for ; Sat, 01 Aug 2026 15:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785621692; x=1786226492; 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=6crITnQf0AA10KnjmQzAxCPQHRm39qApxGuVVNfjYZs=; b=gJRresyNBALjoqKc/66TtEsPPXHMOZr6YmYOpBuzdFCjAAzBEgLs3U7EWB+I1s0Aa8 n3XBmFe7mzhsx/uPeDyrsWnzV2JQyUTeGQVrk4GSqWSKZHUx1MUNAM/gUyQJN83T1p5V fj95wBPSdAkeCSPbUciqxTx3tC1quKD96Fkg16T6T9Mw0PhriBz5fc2VQPwNnsN5L283 AoaDCNkyzB1dZOLbvFbX3uDQSe0jIhcDaCKlXP3+ETaPaA5eNiQWJCL9nQE56jaTiUNO Xt83RXZ3PzlNt9xepxiCf1dgsSKWwcEfNmUScdRApFFXNFRAA/+hMXxns2cu54quPikY AjyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785621692; x=1786226492; 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=6crITnQf0AA10KnjmQzAxCPQHRm39qApxGuVVNfjYZs=; b=hDQdEp3SFZXoWOM9yQeZuzwqzvQktVAaMCh6S4SqOXaZMTDwWsglHS07uIIV7PCcYg BI4/TO2+F87N9ZH6MZ4iwswzSAZ0pni79YjqVCnxPyVezzYPsTFkkB13rQpR1jWGVFCQ ur2o2x6jboWeW/FUBqBuq2xyxRtn0LbC2b+OvB4X7K+R0sARq5i/A+Pof+3ZIE+eeIZL Cp+lA2S95W4CovVOT04HHXRl0IJuUJbz6tS67IXyIUHDKcT5rTsrFqC1XdhJGZsX8dqs N+SffU3fspbbtLTz+HsGkf/6Bwz6s2gzkkyaJNzaG/SLZHtpI8jzk1ENwaG2UbbNRjUu S69Q== X-Forwarded-Encrypted: i=1; AHgh+RqDV5s0Z/G7S8rs3mnkOvSMJ8rrU3B/uanhON+/OARXvqos9SHmtaw3HfqpdZD68ntj8MBNpMKO7ClUm3k=@vger.kernel.org X-Gm-Message-State: AOJu0YznkmEODmz/Xl61i5APJXFdp2Fzpzh86dLo0852EjDLrZgNCVQL oDAonKTYKVG2wNNqi7dZ9Cff27sxLKIg+6euseNe0pK62VNd254csP+Y X-Gm-Gg: AR+sD12gF/ZoyZJqghqinfE//q+TLW6JtaHlJKrH/PEIAsxPyZUuUCkIijlm9GpqfkX ShQDy5bkEbCOvBw6sPp/oPPyPmAqwA9qQZ94DFW8EVKrqvjZ1G8SYyTVK+3sMhYKHeK0uAXjiEV 0zWqo+0RcqCcOhHgYUrOhSAWaQLS31MaWUn6eZZKTtCrOC8RY5QOyNdEjWRXvg6cNCRJwUrCQqF 81Z/Iuf3RNWDB1et00zcLbT8I0unsG4xtjqCDKNfg8GjTrybJWXKe/tBgUk2urYU3FQy9Wj+j7l s0PNWw2/7t90F/en0yLlB6x+ADcJdS5sXcMxhbyc/cZtB+OXAt145JmKnsN94jQV7tSuMZKTuE/ aTFzqy319y2uJVzm+OfpubAz1cQVsYWJ76Iaf2NKkBqiaMukJuD9fPK+GcrYf2+ySq2GK8td3IP 0ph1Ir9VD5GzTcEbCwfh08nnoB9OoD9QU69KqE4zRvAJY6oK24uxaL7dMYk378+D5o6HKnl8/sO wFSNkY= X-Received: by 2002:a05:690c:450a:b0:809:9422:8c47 with SMTP id 00721157ae682-81fd4b5a2e1mr70880997b3.22.1785621692499; Sat, 01 Aug 2026 15:01:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2026 15:01:31 -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 16/19] jbd2: report journal write errors with BH_Write_EIO Date: Sat, 1 Aug 2026 18:01:00 -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 The journal's own write completion handler, journal_end_buffer_io_sync(), reports a failed write by clearing BH_Uptodate, and the three places that wait for journal writes look for that. This series is removing that convention: a buffer whose write failed still holds the data that was supposed to reach the disk, and saying it is not up to date makes callers rewrite, re-read or WARN over data that was never wrong. Set BH_Write_EIO instead, with mark_buffer_write_io_error(), and test it in journal_wait_on_commit_record() and in the two commit-phase waits. The two changes have to go together, because commit phase 4 waits on a mixed list: descriptor blocks are submitted with journal_end_buffer_io_sync(), while revoke blocks go through write_dirty_buffer() and land in bh_end_write(). bh_end_write() already sets BH_Write_EIO, so converting the consumer alone would keep working for revoke blocks and silently stop detecting failed descriptor writes. With the handler converted, both halves of the list report the same way. mark_buffer_write_io_error() is safe on all of these buffers. The shadow buffers from jbd2_journal_write_metadata_buffer() have no folio and no associated mapping, so it does nothing beyond setting the flag. Descriptor and commit blocks are ordinary buffers on the journal device, and marking the journal's mapping with the error is what write_dirty_buffer() already does for revoke blocks on the same device. Signed-off-by: Chao Shi --- fs/jbd2/commit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 60273cddf434..8912786ebebb 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -39,7 +39,7 @@ static void journal_end_buffer_io_sync(struct bio *bio) if (uptodate) set_buffer_uptodate(bh); else - clear_buffer_uptodate(bh); + mark_buffer_write_io_error(bh); if (orig_bh) { clear_and_wake_up_bit(BH_Shadow, &orig_bh->b_state); } @@ -169,7 +169,7 @@ static int journal_wait_on_commit_record(journal_t *journal, clear_buffer_dirty(bh); wait_on_buffer(bh); - if (unlikely(!buffer_uptodate(bh))) + if (unlikely(buffer_write_io_error(bh))) ret = -EIO; put_bh(bh); /* One for getblk() */ @@ -840,7 +840,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) wait_on_buffer(bh); cond_resched(); - if (unlikely(!buffer_uptodate(bh))) + if (unlikely(buffer_write_io_error(bh))) err = -EIO; jbd2_unfile_log_bh(bh); stats.run.rs_blocks_logged++; @@ -883,7 +883,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) wait_on_buffer(bh); cond_resched(); - if (unlikely(!buffer_uptodate(bh))) + if (unlikely(buffer_write_io_error(bh))) err = -EIO; BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); -- 2.43.0