[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio_pcs: check fuse_conn args

Konstantin Khorenko khorenko at virtuozzo.com
Wed May 23 10:59:41 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.1
------>
commit 67e7de76237f45f40ebbe72adf502b87dcf2f369
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Wed May 23 10:59:41 2018 +0300

    fs/fuse kio_pcs: check fuse_conn args
    
    Allow initialization of kdirect only for vstorage/pstorage.
    
    https://jira.sw.ru/browse/HCI-52
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    Acked-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c          | 4 ----
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 9 ++++-----
 include/linux/fs.h                 | 5 +++++
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 0e72656ec8f9..c6094144c7a5 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3880,10 +3880,6 @@ static int ploop_truncate(struct ploop_device * plo, unsigned long arg)
 	return err;
 }
 
-#define IS_PSTORAGE(sb) (sb->s_magic == FUSE_SUPER_MAGIC && \
-			 (!strcmp(sb->s_subtype, "pstorage") || \
-			  !strcmp(sb->s_subtype, "vstorage")))
-
 static int ploop_bd_full(struct backing_dev_info *bdi, long long nr, int root)
 {
 	struct ploop_device *plo      = bdi->congested_data;
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 09d79769d1fc..f4c0fb15403e 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -141,16 +141,15 @@ void kpcs_conn_abort(struct fuse_conn *fc)
 }
 
 static int kpcs_probe(struct fuse_conn *fc, char *name)
-
 {
-	printk("%s TODO IMPLEMENT check fuse_conn args here!\n", __FUNCTION__);
-	if (!strncmp(name, kio_pcs_ops.name, FUSE_KIO_NAME))
+	if (IS_PSTORAGE(fc->sb))
 		return 1;
 
+	pr_err("FUSE: kio_pcs: kdirect is only available for"
+	       "pstorage/vstorage fuse mount\n");
 	return 0;
 }
 
-
 static int fuse_pcs_getfileinfo(struct fuse_conn *fc, struct file *file,
 				struct pcs_mds_fileinfo *info)
 {
@@ -1292,7 +1291,7 @@ static int fuse_ktrace_setup(struct fuse_conn * fc)
 static struct fuse_kio_ops kio_pcs_ops = {
 	.name		= "pcs",
 	.owner		= THIS_MODULE,
-	.probe		= kpcs_probe, /*TODO: check sb->dev name */
+	.probe		= kpcs_probe,
 
 	.conn_init	= kpcs_conn_init,
 	.conn_fini	= kpcs_conn_fini,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1c5144180012..2140b0d7a06f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1713,6 +1713,11 @@ struct super_block {
 	struct list_lru		s_inode_lru ____cacheline_aligned_in_smp;
 };
 
+#define IS_PSTORAGE(sb) ((sb)->s_magic == FUSE_SUPER_MAGIC && \
+			 (sb)->s_subtype && \
+			 (!strcmp((sb)->s_subtype, "pstorage") || \
+			  !strcmp((sb)->s_subtype, "vstorage")))
+
 extern const unsigned super_block_wrapper_version;
 struct super_block_wrapper {
 	struct super_block sb;


More information about the Devel mailing list