From: Jeff Layton <jlayton@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>,
ying chen <yc1082463@gmail.com>,
djwong@kernel.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] xfs: report a writeback error on a read() call
Date: Tue, 24 Jun 2025 16:25:41 -0400 [thread overview]
Message-ID: <e4d49263644f7704074ea0a5149fd834fb3f3603.camel@kernel.org> (raw)
In-Reply-To: <aFsC2vTJNG7UmfMi@casper.infradead.org>
On Tue, 2025-06-24 at 20:56 +0100, Matthew Wilcox wrote:
> On Tue, Jun 24, 2025 at 02:26:18PM -0400, Jeff Layton wrote:
> > On Tue, 2025-06-24 at 07:14 -0700, Christoph Hellwig wrote:
> > > On Sun, Jun 22, 2025 at 08:32:18PM +0800, ying chen wrote:
> > > > Normally, user space returns immediately after writing data to the
> > > > buffer cache. However, if an error occurs during the actual disk
> > > > write operation, data loss may ensue, and there is no way to report
> > > > this error back to user space immediately. Current kernels may report
> > > > writeback errors when fsync() is called, but frequent invocations of
> > > > fsync() can degrade performance. Therefore, a new sysctl
> > > > fs.xfs.report_writeback_error_on_read is introduced, which, when set
> > > > to 1, reports writeback errors when read() is called. This allows user
> > > > space to be notified of writeback errors more promptly.
> > >
> > > That's really kernel wide policy and not something magic done by a
> > > single file system.
> >
> > ...not to mention that getting an error back on a read for a prior
> > writeback error would be completely unexpected by most applications.
>
> Well. It's somewhat understandable:
>
> write() (returns success)
> writeback happens, error logged
> memory pressure evicts folio
> read() brings folio into page cache
> attempt to read contents fails, error returned
>
> I'm not sure it's a good solution, but it's plausible.
Personally, I find it confusing. The range you're trying to read might
actually be fine if the error happened in a different range.
It also has the same problem as reporting writeback errors on close(),
in that it's non-deterministic. You might not see an error if writeback
didn't happen yet. Just because you didn't get an error when reading,
that doesn't mean that your data is actually safe.
Maybe this is ok as an opt-in thing for some workloads, but it does
have some potential footguns.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-06-24 20:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-22 12:32 ying chen
2025-06-24 14:14 ` Christoph Hellwig
2025-06-24 18:26 ` Jeff Layton
2025-06-24 19:56 ` Matthew Wilcox
2025-06-24 20:25 ` Jeff Layton [this message]
2025-06-25 2:44 ` Yafang Shao
2025-06-25 7:01 ` Christoph Hellwig
2025-06-25 10:40 ` Jeff Layton
2025-06-25 11:21 ` Christoph Hellwig
2025-06-25 11:49 ` Jeff Layton
2025-06-25 11:56 ` Christoph Hellwig
2025-06-25 14:06 ` Jeff Layton
2025-06-26 2:41 ` Yafang Shao
2025-06-26 3:57 ` Dave Chinner
2025-06-26 10:25 ` Christoph Hellwig
2025-06-26 22:22 ` Dave Chinner
2025-06-27 21:19 ` Matthew Wilcox
2025-06-26 10:23 ` Christoph Hellwig
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=e4d49263644f7704074ea0a5149fd834fb3f3603.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=willy@infradead.org \
--cc=yc1082463@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®