lkml.org 
[lkml]   [2018]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 11/11] vfs: have call_sync_fs op report writeback errors when passed a since pointer
Date
From: Jeff Layton <jlayton@redhat.com>

...on filesystems that don't define a ->sync_fs operation.

Signed-off-by: Jeff Layton <jlayton@redhat.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
\
 
 \ /
  Last update: 2018-05-18 14:36    [W:0.246 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site