Re: [PATCH v2 2/2] xfs: skip the fsync flush when a later flush has completed
From: Christoph Hellwig
Date: Fri Nov 20 2026 - 13:30:15 EST
On Wed, Nov 11, 2026 at 12:17:12PM +0900, Daejun Park via B4 Relay wrote:
> Suggested-by: Christoph Hellwig <hch@xxxxxx>
> Signed-off-by: Daejun Park <daejun7.park@xxxxxxxxxxx>
> ---
> Christoph's 2017 mail with the sequence counter idea:
> https://lore.kernel.org/20170830142134.GA650@xxxxxx
Heh, I was going to say I didn't remember suggesting this publically,
but hey, if it wa 9 years ago I at least have an excuse for the memory
loss :)
> With an internal log, an fsync that takes the new skip can miss a
> failed flush on bio-based dm. dm drops the error of a preflush sent
> with data, unless the table is linear or stripe on a single device.
> The skip trusts the status of the iclog bio, as the log and the fsync
> that wrote the iclog already do. Before this patch the other fsyncs
> sent their own flush and returned its result. With 8 writers on a
> two-device linear table whose second device fails every flush, 2590
> of 4000 fsyncs returned EIO before and 37 do now. From the code,
> bcache in writeback mode drops that error too. md reports no flush
> error at all. Neither was tested.
I think you've fixed this bug in dm in the meantime, right?
> @@ -119,12 +122,21 @@ xfs_file_fsync(
> * file data target cache here. This can happen for fdatasync/O_DSYNC
> * when no metadata needed to be committed.
> *
> + * Flush the file data target unless a flush submitted to it after the
> + * data writes above completed has already finished. That is usually
> + * the flush before an iclog written out by this log force or by
> + * another task, or another fsync's flush.
> + *
> + * DAX writes are not block I/O, so DAX only skips the flush when
> + * this log force flushed, as before.
I don't get the DAX part. As far as cache flushes are concerned we
don't special case DAX anywhere else, why here?