[RFC PATCH 10/11] ext2: have sync_fs op report writeback errors when passed a since pointer

From: Jeff Layton
Date: Fri May 18 2018 - 07:39:29 EST


From: Jeff Layton <jlayton@xxxxxxxxxx>

Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
fs/ext2/super.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 0700f3264c7e..51b548cfebb1 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1264,6 +1264,7 @@ void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es,
*/
static int ext2_sync_fs(struct super_block *sb, int wait, errseq_t *since)
{
+ int ret;
struct ext2_sb_info *sbi = EXT2_SB(sb);
struct ext2_super_block *es = EXT2_SB(sb)->s_es;

@@ -1280,7 +1281,13 @@ static int ext2_sync_fs(struct super_block *sb, int wait, errseq_t *since)
}
spin_unlock(&sbi->s_lock);
ext2_sync_super(sb, es, wait);
- return __sync_blockdev(sb->s_bdev, wait);
+ ret = __sync_blockdev(sb->s_bdev, wait);
+ if (since) {
+ int ret2 = errseq_check_and_advance(&sb->s_wb_err, since);
+ if (ret == 0)
+ ret = ret2;
+ }
+ return ret;
}

static int ext2_freeze(struct super_block *sb)
--
2.17.0