linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUESTION] xfs, iomap: Handle writeback errors to prevent silent data corruption
@ 2025-05-29  2:50 Yafang Shao
  2025-05-29  4:25 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Yafang Shao @ 2025-05-29  2:50 UTC (permalink / raw)
  To: Christian Brauner, djwong, cem; +Cc: linux-xfs, Linux-Fsdevel

Hello,

Recently, we encountered data loss when using XFS on an HDD with bad
blocks. After investigation, we determined that the issue was related
to writeback errors. The details are as follows:

1. Process-A writes data to a file using buffered I/O and completes
without errors.
2. However, during the writeback of the dirtied pagecache pages, an
I/O error occurs, causing the data to fail to reach the disk.
3. Later, the pagecache pages may be reclaimed due to memory pressure,
since they are already clean pages.
4. When Process-B reads the same file, it retrieves zeroed data from
the bad blocks, as the original data was never successfully written
(IOMAP_UNWRITTEN).

We reviewed the related discussion [0] and confirmed that this is a
known writeback error issue. While using fsync() after buffered
write() could mitigate the problem, this approach is impractical for
our services.

Instead, we propose introducing configurable options to notify users
of writeback errors immediately and prevent further operations on
affected files or disks. Possible solutions include:

- Option A: Immediately shut down the filesystem upon writeback errors.
- Option B: Mark the affected file as inaccessible if a writeback error occurs.

These options could be controlled via mount options or sysfs
configurations. Both solutions would be preferable to silently
returning corrupted data, as they ensure users are aware of disk
issues and can take corrective action.

Any suggestions ?

[0] https://lwn.net/Articles/724307/

-- 
Regards
Yafang

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

end of thread, other threads:[~2025-07-02 18:41 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-29  2:50 [QUESTION] xfs, iomap: Handle writeback errors to prevent silent data corruption Yafang Shao
2025-05-29  4:25 ` Darrick J. Wong
2025-05-29  5:55   ` Yafang Shao
2025-05-30  5:17   ` Christian Brauner
2025-05-30 15:38     ` Darrick J. Wong
2025-05-31 23:02       ` Dave Chinner
2025-06-03  0:03         ` Darrick J. Wong
2025-06-06 10:43           ` Christian Brauner
2025-06-12  3:43             ` Darrick J. Wong
2025-06-12  6:29               ` Amir Goldstein
2025-07-02 18:41                 ` Darrick J. Wong
2025-06-02  5:32   ` Christoph Hellwig
2025-06-03 14:35     ` Darrick J. Wong
2025-06-03 14:38       ` Christoph Hellwig
2025-05-29  4:36 ` Dave Chinner
2025-05-29  6:04   ` Yafang Shao
2025-06-02  5:38   ` Christoph Hellwig
2025-06-02 23:19     ` Dave Chinner
2025-06-03  4:50       ` Christoph Hellwig
2025-06-03 22:05         ` Dave Chinner
2025-06-04  6:33           ` Christoph Hellwig
2025-06-05  2:18             ` Dave Chinner
2025-06-05  4:51               ` Christoph Hellwig
2025-06-02  5:31 ` Christoph Hellwig
2025-06-03  3:03   ` Yafang Shao
2025-06-03  3:13     ` Matthew Wilcox
2025-06-03  3:21       ` Yafang Shao
2025-06-03  3:26         ` Matthew Wilcox
2025-06-03  3:50           ` Yafang Shao
2025-06-03  4:40             ` Christoph Hellwig
2025-06-03  5:17               ` Damien Le Moal
2025-06-03  5:54                 ` Yafang Shao
2025-06-03  6:36                   ` Damien Le Moal
2025-06-03 14:41                     ` Christoph Hellwig
2025-06-03 14:57                       ` James Bottomley
2025-06-04  7:29                         ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).