[Devel] [PATCH RHEL7 COMMIT] fuse kio: Introduce fast path protocol version,
Konstantin Khorenko
khorenko at virtuozzo.com
Wed May 30 14:48:59 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.3
------>
commit 21edce574b4ec285a4f57e4c8f194f053df67ced
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed May 30 14:48:58 2018 +0300
fuse kio: Introduce fast path protocol version,
Send fast path version on PCS_IOC_INIT_KDIRECT request
and check the userspace answered version is the same.
Note, that patch changes PCS_IOC_INIT_KDIRECT ioctl()
cmd number, since struct pcs_ioc_init_kdirect becomes
bigger.
https://pmc.acronis.com/browse/VSTOR-10131
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 15 ++++++++++++++-
fs/fuse/kio/pcs/pcs_ioctl.h | 3 +++
fs/fuse/kio/pcs/pcs_prot_types.h | 5 +++++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 930ddff1b680..a4064904f963 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -48,6 +48,16 @@ static void process_pcs_init_reply(struct fuse_conn *fc, struct fuse_req *req)
fc->conn_error = 1;
goto out;
}
+
+ if (info->version.major != PCS_FAST_PATH_VERSION.major ||
+ info->version.minor != PCS_FAST_PATH_VERSION.minor) {
+ pr_err("kio_pcs: version missmatch: must be %u.%u\n",
+ PCS_FAST_PATH_VERSION.major,
+ PCS_FAST_PATH_VERSION.minor);
+ fc->conn_error = 1;
+ goto out;
+ }
+
pfc = kvmalloc(sizeof(*pfc), GFP_KERNEL);
if (!pfc) {
fc->conn_error = 1;
@@ -100,11 +110,14 @@ int kpcs_conn_init(struct fuse_conn *fc)
inarg = &req->misc.ioctl.in;
outarg = &req->misc.ioctl.out;
inarg->cmd = PCS_IOC_INIT_KDIRECT;
+ info->version = PCS_FAST_PATH_VERSION;
req->in.h.opcode = FUSE_IOCTL;
- req->in.numargs = 1;
+ req->in.numargs = 2;
req->in.args[0].size = sizeof(*inarg);
req->in.args[0].value = inarg;
+ req->in.args[1].size = sizeof(*info);
+ req->in.args[1].value = info;
req->out.numargs = 2;
req->out.args[0].size = sizeof(*outarg);
req->out.args[0].value = outarg;
diff --git a/fs/fuse/kio/pcs/pcs_ioctl.h b/fs/fuse/kio/pcs/pcs_ioctl.h
index 6451baabb492..14d4fc33fdf1 100644
--- a/fs/fuse/kio/pcs/pcs_ioctl.h
+++ b/fs/fuse/kio/pcs/pcs_ioctl.h
@@ -10,6 +10,8 @@
#include "pcs_map.h"
#include "pcs_rpc.h"
+#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){1, 0})
+
#define PCS_FUSE_INO_SPECIAL_ ((unsigned long long)-0x1000)
struct pcs_client_lease_info
@@ -35,6 +37,7 @@ struct pcs_ioc_init_kdirect
{
PCS_NODE_ID_T node_id;
PCS_CLUSTER_ID_T cluster_id;
+ PCS_FAST_PATH_VERSION_T version;
};
struct pcs_ioc_fileinfo
diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
index d8852f6ffda5..39a1d674cc96 100644
--- a/fs/fuse/kio/pcs/pcs_prot_types.h
+++ b/fs/fuse/kio/pcs/pcs_prot_types.h
@@ -73,6 +73,11 @@ typedef u64 PCS_CHUNK_UID_T;
typedef u64 PCS_LEASE_GEN_T;
typedef u32 PCS_POLICY_GEN_T;
+typedef struct {
+ u32 major;
+ u32 minor;
+} PCS_FAST_PATH_VERSION_T;
+
/*
* File attributes
*/
More information about the Devel
mailing list