[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180518123415.28181-12-jlayton@kernel.org>
Date: Fri, 18 May 2018 08:34:15 -0400
From: Jeff Layton <jlayton@...nel.org>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: viro@...IV.linux.org.uk, willy@...radead.org, andres@...razel.de
Subject: [RFC PATCH 11/11] vfs: have call_sync_fs op report writeback errors when passed a since pointer
From: Jeff Layton <jlayton@...hat.com>
...on filesystems that don't define a ->sync_fs operation.
Signed-off-by: Jeff Layton <jlayton@...hat.com>
---
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
Powered by blists - more mailing lists