Skip to content

fs: introduce new writeback error reporting and convert ext2 and ext4 to use it

Jeff Layton linux-block linux-ext4 linux-fsdevel lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest17 patches 8 repliesIn review
  2. v1 RFC4 patches 49 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17lib: add errseq_t type and infrastructure for handling itinclude/linux/errseq.h lib/Makefile lib/errseq.c+220 -10 replies
2/17fs: new infrastructure for writeback error handling and reportingdrivers/dax/device.c fs/block_dev.c fs/file_table.c +3 more+97 -00 replies
3/17mm: tracepoints for writeback error eventsinclude/linux/errseq.h include/linux/fs.h include/trace/events/filemap.h +2 more+86 -90 replies
4/17fs: add a new fstype flag to indicate how writeback errors are trackedinclude/linux/fs.h include/linux/pagemap.h mm/filemap.c+34 -60 replies
5/17Documentation: flesh out the section in vfs.txt on storing and reporting writeback errorsDocumentation/filesystems/vfs.txt+47 -30 replies
6/17fs: adapt sync_file_range to new reporting infrastructurefs/sync.c+13 -40 replies
7/17mm: add filemap_fdatawait_range_since and filemap_write_and_wait_range_sinceinclude/linux/fs.h mm/filemap.c+76 -00 replies
8/17dax: set errors in mapping when writeback failsfs/dax.c+17 -12 replies
9/17block: convert to errseq_t based writeback error trackingfs/block_dev.c+10 -30 replies
10/17block: add sync_blockdev_since and sync_filesystem_sincefs/block_dev.c fs/internal.h fs/sync.c +1 more+80 -10 replies
11/17fs: add f_md_wb_err field to struct file for tracking metadata errorsinclude/linux/fs.h include/trace/events/filemap.h mm/filemap.c+44 -220 replies
12/17fs: allow __generic_file_fsync to support both flavors of error reportingfs/libfs.c+19 -70 replies
13/17jbd2: conditionally handle errors using errseq_t based on FS_WB_ERRSEQ flagfs/jbd2/commit.c fs/jbd2/recovery.c fs/jbd2/transaction.c +1 more+26 -120 replies
14/17ext4: convert to errseq_t based error trackingfs/ext4/dir.c fs/ext4/ext4.h fs/ext4/extents.c +5 more+68 -370 replies
15/17fs: add a write_one_page_sinceinclude/linux/mm.h mm/page-writeback.c+43 -120 replies
16/17ext2: convert to errseq_t based writeback error trackingfs/ext2/dir.c fs/ext2/file.c fs/ext2/super.c+32 -70 replies
17/17fs: convert ext2 to use write_one_page_sincefs/ext2/dir.c+11 -60 replies

Reviews trailers per patch

3 of 17 patches have a Reviewed-by or Acked-by.

PatchNeilBrownJan KaraChristoph HellwigRoss Zwisler
1/17R-b
2/17R-b
3/17
4/17
5/17
6/17
7/17
8/17R-b R-b Reviewed-and-Tested-by
9/17
10/17
11/17
12/17
13/17
14/17
15/17
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v5 thread

Cover letter [PATCH v5 00/17] fs: introduce new writeback error reporting and convert ext2 and ext4 to use it

v5: don't retrofit old API over the new infrastructure
add fstype flag to indicate how wb errors are tracked within that fs add more function variants that take a errseq_t "since" value add second errseq_t to struct file to track metadata wb errors convert ext4 and ext2 to use the new APIs

v4: several more cleanup patches
documentation and kerneldoc comment updates fix bugs in gfs2 patches
make sync_file_range use same error reporting semantics bugfixes in buffer.c
convert nfs to new scheme (maybe bogus, can be dropped)

v3: wb_err_t -> errseq_t conversion
clean up places that re-set errors after calling filemap_* functions

v2: introduce wb_err_t, use atomics

This is v5 of the patchset to improve how we're tracking and reporting errors that occur during pagecache writeback. The main difference in this set from the last one is that I've stopped trying to retrofit the old error tracking API on top of the new one. This is more work since we'll have to touch each fs individually, but should be safer as the "since" values used for checking errors will be more deliberate.

There are several situations where the kernel can "lose" errors that occur during writeback, such that fsync will return success even though it failed to write back some data previously. The basic idea here is to have the kernel be more deliberate about the point from which errors are checked to ensure that that doesn't happen.

An additional aim of this set is to change the behavior of fsync in Linux to report writeback errors on all fds instead of just the first one. This allows writers to reliably tell whether their data made it to the backing device without having to coordinate fsync calls with other writers.

To do this, we add a new typedef: errseq_t. This is a 32-bit value that can store an error code, and a sequence number so we can tell whether it has changed since we last sampled it. This allows us to record errors in the address_space and then report those errors only once per file description.

This set just alters block device files, ext4 and the legacy ext2 driver. If this general approach seems acceptable, then I'll start converting other filesystems in follow-on patchsets. I'd also like to get this into linux-next as soon as possible to ensure that we're banging out any bugs that might be lurking here.

I also have a couple of xfstests for this as well that I'll re-post soon.

Jeff Layton (17):
lib: add errseq_t type and infrastructure for handling it
fs: new infrastructure for writeback error handling and reporting
mm: tracepoints for writeback error events
fs: add a new fstype flag to indicate how writeback errors are tracked
Documentation: flesh out the section in vfs.txt on storing and
reporting writeback errors
fs: adapt sync_file_range to new reporting infrastructure
mm: add filemap_fdatawait_range_since and
filemap_write_and_wait_range_since
dax: set errors in mapping when writeback fails
block: convert to errseq_t based writeback error tracking
block: add sync_blockdev_since and sync_filesystem_since
fs: add f_md_wb_err field to struct file for tracking metadata errors
fs: allow __generic_file_fsync to support both flavors of error
reporting
jbd2: conditionally handle errors using errseq_t based on FS_WB_ERRSEQ
flag
ext4: convert to errseq_t based error tracking
fs: add a write_one_page_since
ext2: convert to errseq_t based writeback error tracking
fs: convert ext2 to use write_one_page_since

 Documentation/filesystems/vfs.txt |  50 ++++++++-
 drivers/dax/device.c              |   1 +
 fs/block_dev.c                    |  29 +++++-
 fs/dax.c                          |  18 +++-
 fs/ext2/dir.c                     |  25 +++--
 fs/ext2/file.c                    |  29 ++++--
 fs/ext2/super.c                   |   2 +-
 fs/ext4/dir.c                     |   8 +-
 fs/ext4/ext4.h                    |   8 +-
 fs/ext4/extents.c                 |  24 +++--
 fs/ext4/file.c                    |   5 +-
 fs/ext4/fsync.c                   |  23 ++++-
 fs/ext4/inode.c                   |  19 ++--
 fs/ext4/ioctl.c                   |   9 +-
 fs/ext4/super.c                   |   9 +-
 fs/file_table.c                   |   1 +
 fs/internal.h                     |   8 ++
 fs/jbd2/commit.c                  |  29 ++++--
 fs/jbd2/recovery.c                |   5 +-
 fs/jbd2/transaction.c             |   1 +
 fs/libfs.c                        |  26 +++--
 fs/open.c                         |   3 +
 fs/sync.c                         |  62 +++++++++++-
 include/linux/errseq.h            |  19 ++++
 include/linux/fs.h                |  82 ++++++++++++++-
 include/linux/jbd2.h              |   3 +
 include/linux/mm.h                |   2 +
 include/linux/pagemap.h           |  32 ++++--
 include/trace/events/filemap.h    |  52 ++++++++++
 lib/Makefile                      |   2 +-
 lib/errseq.c                      | 208 ++++++++++++++++++++++++++++++++++++++
 mm/filemap.c                      | 145 ++++++++++++++++++++++++++
 mm/page-writeback.c               |  53 +++++++---
 33 files changed, 892 insertions(+), 100 deletions(-)
 create mode 100644 include/linux/errseq.h
 create mode 100644 lib/errseq.c
Signature · 1 line
2.9.4