[3/3] ext4: track writeback errors using the generic tracking infrastructure

Message ID 20181231194836.3761-3-tytso@mit.edu
State New
Headers show
Series
  • [1/3] ext4: avoid kernel warning when writing the superblock to a dead device
Related show

Commit Message

Theodore Ts'o Dec. 31, 2018, 7:48 p.m.
We already using mapping_set_error() in fs/ext4/page_io.c, so all we
need to do is to use file_check_and_advance_wb_err() when handling
fsync() requests in ext4_sync_file().

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
---
 fs/ext4/fsync.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 87a7ff00ef62..712f00995390 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -164,6 +164,9 @@  int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 			ret = err;
 	}
 out:
+	err = file_check_and_advance_wb_err(file);
+	if (ret == 0)
+		ret = err;
 	trace_ext4_sync_file_exit(inode, ret);
 	return ret;
 }