From: Jeff Layton <jlayton@xxxxxxxxxx> ...on filesystems that don't define a ->sync_fs operation. Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- include/linux/fs.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) NB: I'm not sure this is something we really want to do. It's a bit cavalier and some filesystems might not like it if they are tracking errors in other ways. An alternative here is to add a simple_sync_fs helper that does this and add that to a whole swath of different fs'. diff --git a/include/linux/fs.h b/include/linux/fs.h index fecd29325f36..1ff9d4d119cb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2505,9 +2505,18 @@ extern const struct file_operations def_chr_fops; static inline int call_sync_fs(struct super_block *sb, int wait, errseq_t *since) { + int ret; + if (sb->s_op->sync_fs) return sb->s_op->sync_fs(sb, wait, since); - 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; } #ifdef CONFIG_BLOCK -- 2.17.0