[RHEL7,COMMIT] fuse kio: Make KIO to require writeback_cache

Submitted by Konstantin Khorenko on July 6, 2018, 9:41 a.m.

Details

Message ID 201807060941.w669flID015075@finist_ce7.work
State New
Series "fuse kio: Make KIO to require writeback_cache"
Headers show

Commit Message

Konstantin Khorenko July 6, 2018, 9:41 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.15
------>
commit 34968623c3221ec65b86892fe20c23e6c4759965
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Jul 6 12:41:47 2018 +0300

    fuse kio: Make KIO to require writeback_cache
    
    This patch adds sanity check for writeback_cache
    parameter is passed in case of kio engine is enabled.
    We do require it, so let's add the hard sanity check.
    We also could enable writeback_cache forced in case
    of kio is enabled, but since userspace currently always
    passes it, let's just check for this.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
---
 fs/fuse/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 07b526818939..6fc09495357a 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1333,11 +1333,12 @@  static int fuse_fill_super(struct super_block *sb, void *data, int silent)
 	fc->max_read = max_t(unsigned, 4096, d.max_read);
 	fc->writeback_cache = d.writeback_cache;
 	if (fc->flags & FUSE_KDIRECT_IO) {
+		err = -EINVAL;
+		if (!fc->writeback_cache)
+			goto err_dev_free;
 		fc->kio.op = fuse_kio_get(fc, d.kio_name);
-		if (!fc->kio.op) {
-			err = -EINVAL;
+		if (!fc->kio.op)
 			goto err_dev_free;
-		}
 	}
 	/* Used by get_root_inode() */
 	sb->s_fs_info = fc;