From: Andrew Morton <akpm@linux-foundation.org>
To: Ilya Dryomov <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>, Xiubo Li <xiubo.li@clyso.com>,
Viacheslav Dubeyko <slava@dubeyko.com>
Cc: ceph-devel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] ceph: preserve data writeback errors in fsync()
Date: Fri, 27 Nov 2026 22:25:32 -0800 [thread overview]
Message-ID: <d56a5a0796c14ef68a178d7a010373c2.1@linux-foundation.org> (raw)
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));
_
next reply other threads:[~2026-11-28 6:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 6:25 Andrew Morton [this message]
2026-11-28 9:59 ` [PATCH] ceph: preserve data writeback errors in fsync() Xiubo Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d56a5a0796c14ef68a178d7a010373c2.1@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=slava@dubeyko.com \
--cc=xiubo.li@clyso.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.