All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: preserve data writeback errors in fsync()
@ 2026-11-28  6:25 Andrew Morton
  2026-11-28  9:59 ` Xiubo Li
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2026-11-28  6:25 UTC (permalink / raw)
  To: Ilya Dryomov, Alex Markuze, Xiubo Li, Viacheslav Dubeyko
  Cc: ceph-devel, Andrew Morton

From: Andrew Morton <akpm@linux-foundation.org>
Subject: ceph: preserve data writeback errors in fsync()
Date: Mon, 23 Nov 2026 13:28:28 -0800

file_write_and_wait_range() can return -EIO for failed data writeback and
advances the file's writeback error cursor.  ceph_fsync() then overwrites
that return value with the result of ceph_wait_on_async_create(), which is
normally zero.  The later file_check_and_advance_wb_err() cannot recover
the error because the cursor has already advanced.  As a result, fsync()
can report success after an ordinary writeback I/O failure or after a
memory failure poisons a dirty page-cache page.

Keep the data writeback result when the async create wait succeeds, while
still returning an error from that wait if it fails.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Alex Markuze <amarkuze@redhat.com>
Cc: Xiubo Li <xiubo.li@clyso.com>
Cc: Viacheslav Dubeyko <slava@dubeyko.com>

 fs/ceph/caps.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/ceph/caps.c~ceph-preserve-data-writeback-errors-in-fsync
+++ a/fs/ceph/caps.c
@@ -2651,9 +2651,11 @@ int ceph_fsync(struct file *file, loff_t
 	if (datasync)
 		goto out;
 
-	ret = ceph_wait_on_async_create(inode);
-	if (ret)
+	err = ceph_wait_on_async_create(inode);
+	if (err) {
+		ret = err;
 		goto out;
+	}
 
 	dirty = try_flush_caps(inode, &flush_tid);
 	doutc(cl, "dirty caps are %s\n", ceph_cap_string(dirty));
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-28 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28  6:25 [PATCH] ceph: preserve data writeback errors in fsync() Andrew Morton
2026-11-28  9:59 ` Xiubo Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.