Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638215 > unrolled thread

[PATCH v4 06/27] fs: check for writeback errors after syncing out buffers in generic_file_fsync

Started byJeff Layton <jlayton@redhat.com>
First post2017-05-09 18:00 +0200
Last post2017-05-10 15:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 06/27] fs: check for writeback errors after syncing out buffers in generic_file_fsync Jeff Layton <jlayton@redhat.com> - 2017-05-09 18:00 +0200
    Re: [PATCH v4 06/27] fs: check for writeback errors after syncing  out buffers in generic_file_fsync Matthew Wilcox <willy@infradead.org> - 2017-05-10 15:00 +0200

#1638215 — [PATCH v4 06/27] fs: check for writeback errors after syncing out buffers in generic_file_fsync

FromJeff Layton <jlayton@redhat.com>
Date2017-05-09 18:00 +0200
Subject[PATCH v4 06/27] fs: check for writeback errors after syncing out buffers in generic_file_fsync
Message-ID<tFfIm-3IS-13@gated-at.bofh.it>
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 case, and help other callers detect
these errors properly as well.

With that, we don't need to twiddle it in ext2.

Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/ext2/file.c | 2 +-
 fs/libfs.c     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index b21891a6bfca..ed00e7ae0ef3 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -177,7 +177,7 @@ int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
 
 	ret = generic_file_fsync(file, start, end, datasync);
-	if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) {
+	if (ret == -EIO) {
 		/* We don't really know where the IO error happened... */
 		ext2_error(sb, __func__,
 			   "detected IO error when writing metadata buffers");
diff --git a/fs/libfs.c b/fs/libfs.c
index a8b62e5d43a9..efd23040ab25 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -991,7 +991,8 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end,
 
 out:
 	inode_unlock(inode);
-	return ret;
+	err = filemap_check_errors(inode->i_mapping);
+	return ret ? ret : err;
 }
 EXPORT_SYMBOL(__generic_file_fsync);
 
-- 
2.9.3

[toc] | [next] | [standalone]


#1638793 — Re: [PATCH v4 06/27] fs: check for writeback errors after syncing out buffers in generic_file_fsync

FromMatthew Wilcox <willy@infradead.org>
Date2017-05-10 15:00 +0200
SubjectRe: [PATCH v4 06/27] fs: check for writeback errors after syncing out buffers in generic_file_fsync
Message-ID<tFznH-QK-7@gated-at.bofh.it>
In reply to#1638215
On Tue, May 09, 2017 at 11:49:09AM -0400, Jeff Layton wrote:
> 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 case, and help other callers detect
> these errors properly as well.
> 
> With that, we don't need to twiddle it in ext2.
> 
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Jan Kara <jack@suse.cz>

Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web