[PATCH v8 14/18] block: convert to errseq_t based writeback error tracking

2017-06-29 Thread jlayton
From: Jeff Layton This is a very minimal conversion to errseq_t based error tracking for raw block device access. Just have it use the standard file_write_and_wait_range call. Note that there are internal callers that call sync_blockdev and the like that are not affected by

[PATCH v8 15/18] fs: convert __generic_file_fsync to use errseq_t based reporting

2017-06-29 Thread jlayton
From: Jeff Layton Signed-off-by: Jeff Layton --- fs/libfs.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 1dec90819366..3aabe553fc45 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -974,7 +974,7 @@

[PATCH v8 12/18] Documentation: flesh out the section in vfs.txt on storing and reporting writeback errors

2017-06-29 Thread jlayton
From: Jeff Layton Let's try to make this extra clear for fs authors. Cc: Jan Kara Signed-off-by: Jeff Layton --- Documentation/filesystems/vfs.txt | 43 --- 1 file changed, 40 insertions(+), 3

[PATCH v8 02/18] buffer: use mapping_set_error instead of setting the flag

2017-06-29 Thread jlayton
From: Jeff Layton Signed-off-by: Jeff Layton Reviewed-by: Jan Kara Reviewed-by: Matthew Wilcox Reviewed-by: Christoph Hellwig --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH v8 17/18] xfs: minimal conversion to errseq_t writeback error reporting

2017-06-29 Thread jlayton
From: Jeff Layton Just check and advance the data errseq_t in struct file before before returning from fsync on normal files. Internal filemap_* callers are left as-is. Signed-off-by: Jeff Layton --- fs/xfs/xfs_file.c | 2 +- 1 file changed, 1

[PATCH v8 16/18] ext4: use errseq_t based error handling for reporting data writeback errors

2017-06-29 Thread jlayton
From: Jeff Layton Add a call to filemap_report_wb_err at the end of ext4_sync_file. This will ensure that we check and advance the errseq_t in the file, which allows us to track and report errors on all open fds when they occur. Note that metadata writeback errors are not

[PATCH v8 11/18] mm: set both AS_EIO/AS_ENOSPC and errseq_t in mapping_set_error

2017-06-29 Thread jlayton
From: Jeff Layton When a writeback error occurs, we want later callers to be able to pick up that fact when they go to wait on that writeback to complete. Traditionally, we've used AS_EIO/AS_ENOSPC flags to track that, but that's problematic since only one "checker" will be

[PATCH v8 18/18] btrfs: minimal conversion to errseq_t writeback error reporting on fsync

2017-06-29 Thread jlayton
From: Jeff Layton Just check and advance the errseq_t in the file before returning. Internal callers of filemap_* functions are left as-is. Signed-off-by: Jeff Layton --- fs/btrfs/file.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff

[PATCH v8 10/18] fs: new infrastructure for writeback error handling and reporting

2017-06-29 Thread jlayton
From: Jeff Layton Most filesystems currently use mapping_set_error and filemap_check_errors for setting and reporting/clearing writeback errors at the mapping level. filemap_check_errors is indirectly called from most of the filemap_fdatawait_* functions and from

[PATCH v8 09/18] lib: add errseq_t type and infrastructure for handling it

2017-06-29 Thread jlayton
From: Jeff Layton An errseq_t is a way of recording errors in one place, and allowing any number of "subscribers" to tell whether an error has been set again since a previous time. It's implemented as an unsigned 32-bit value that is managed with atomic operations. The low

[PATCH v8 08/18] mm: clean up error handling in write_one_page

2017-06-29 Thread jlayton
From: Jeff Layton Don't try to check PageError since that's potentially racy and not necessarily going to be set after writepage errors out. Instead, check the mapping for an error after writepage returns. Signed-off-by: Jeff Layton Reviewed-by: Jan

[PATCH v8 04/18] buffer: set errors in mapping at the time that the error occurs

2017-06-29 Thread jlayton
From: Jeff Layton I noticed on xfs that I could still sometimes get back an error on fsync on a fd that was opened after the error condition had been cleared. The problem is that the buffer code sets the write_io_error flag and then later checks that flag to set the error in

[PATCH v8 01/18] fs: remove call_fsync helper function

2017-06-29 Thread jlayton
From: Jeff Layton Reviewed-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Carlos Maiolino Signed-off-by: Jeff Layton --- fs/sync.c | 2 +- include/linux/fs.h | 6 -- ipc/shm.c

[PATCH v8 06/18] mm: clear AS_EIO/AS_ENOSPC when writeback initiation fails

2017-06-29 Thread jlayton
From: Jeff Layton filemap_write_and_wait{_range} will return an error if writeback initiation fails, but won't clear errors in the address_space. This is particularly problematic on DAX, as it's effectively synchronous. Ensure that we clear the AS_EIO/AS_ENOSPC flags when

[PATCH v8 13/18] dax: set errors in mapping when writeback fails

2017-06-29 Thread jlayton
From: Jeff Layton Jan Kara's description for this patch is much better than mine, so I'm quoting it verbatim here: DAX currently doesn't set errors in the mapping when cache flushing fails in dax_writeback_mapping_range(). Since this function can get called only from

[PATCH v8 07/18] mm: don't TestClearPageError in __filemap_fdatawait_range

2017-06-29 Thread jlayton
From: Jeff Layton The -EIO returned here can end up overriding whatever error is marked in the address space, and be returned at fsync time, even when there is a more appropriate error stored in the mapping. Read errors are also sometimes tracked on a per-page level using

[PATCH v8 00/18] fs: enhanced writeback error reporting with errseq_t (pile #1)

2017-06-29 Thread jlayton
From: Jeff Layton v8: === - rename filemap_report_wb_err to file_check_and_advance_wb_err (per Darrick's suggestion) - add a file_write_and_wait helper function (per HCH's suggestion) - change __generic_file_fsync to use errseq_t reporting - focus on data writeback for now,

[PATCH v8 05/18] jbd2: don't clear and reset errors after waiting on writeback

2017-06-29 Thread jlayton
From: Jeff Layton Resetting this flag is almost certainly racy, and will be problematic with some coming changes. Make filemap_fdatawait_keep_errors return int, but not clear the flag(s). Have jbd2 call it instead of filemap_fdatawait and don't attempt to re-set the error

[PATCH v8 03/18] fs: check for writeback errors after syncing out buffers in generic_file_fsync

2017-06-29 Thread jlayton
From: Jeff Layton ext2 currently does a test+clear of the AS_EIO flag, which is is problematic for some coming changes. What we really need to do instead is call filemap_check_errors in __generic_file_fsync after syncing out the buffers. That will be sufficient for this

Re: [PATCH v7 21/22] xfs: minimal conversion to errseq_t writeback error reporting

2017-06-26 Thread jlayton
On Mon, 2017-06-26 at 08:22 -0700, Darrick J. Wong wrote: > On Fri, Jun 16, 2017 at 03:34:26PM -0400, Jeff Layton wrote: > > Just check and advance the data errseq_t in struct file before > > before returning from fsync on normal files. Internal filemap_* > > callers are left as-is. > > > >