[RHEL7,COMMIT] fuse kio: missing local client ID initialization

Submitted by Konstantin Khorenko on July 9, 2018, 2:25 p.m.

Details

Message ID 201807091425.w69EPdfT026157@finist_ce7.work
State New
Series "fuse kio: missing local client ID initialization"
Headers show

Commit Message

Konstantin Khorenko July 9, 2018, 2:25 p.m.
The commit is pushed to "branch-rh7-3.10.0-862.6.3.vz7.62.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.6.3.vz7.62.1
------>
commit 086a2be1e3118803d0fccab331b276b81b6f796c
Author: Alexey Kuznetsov <kuznet@virtuozzo.com>
Date:   Mon Jul 9 17:25:39 2018 +0300

    fuse kio: missing local client ID initialization
    
    It was a honest misunderstanding. Instead of critically important
    local_id useless and unused host_id was initialized.
    
    Affects: https://pmc.acronis.com/browse/VSTOR-11651
    
    Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cluster_core.c |  2 +-
 fs/fuse/kio/pcs/pcs_rpc.c          | 16 ++++++++++++++--
 fs/fuse/kio/pcs/pcs_rpc.h          |  1 +
 3 files changed, 16 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_cluster_core.c b/fs/fuse/kio/pcs/pcs_cluster_core.c
index a5bdbc8ebd82..4784f1d2915b 100644
--- a/fs/fuse/kio/pcs/pcs_cluster_core.c
+++ b/fs/fuse/kio/pcs/pcs_cluster_core.c
@@ -140,7 +140,7 @@  int pcs_cc_init(struct pcs_cluster_core *cc, struct workqueue_struct *wq,
 	pcs_rpc_init_gc(&cc->eng, 1024);
 	if (attr) {
 		pcs_rpc_set_cluster_id(&cc->eng, &attr->cluster);
-		pcs_rpc_set_host_id(&cc->eng, &attr->node);
+		pcs_rpc_set_local_id(&cc->eng, &attr->node);
 		if (attr->abort_timeout_ms)
 			pcs_cc_set_abort_timeout(cc, attr->abort_timeout_ms);
 	}
diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index 71c8461bc740..1faa99ec0426 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -941,9 +941,15 @@  void pcs_rpc_call(struct pcs_rpc * ep, struct pcs_msg * msg)
 
 	pcs_rpc_queue(ep, clone);
 }
+
 /* TODO: This pace may not scale well, in fact xid should be unique only
-   across RPC so it may be reasonable to make it percpu
-*/
+ * across RPC so it may be reasonable to make it percpu
+ *
+ * Nope. The comment above is wrong. Not deleted just to ensure this question
+ * is not reraised in future. XIDs are unique per client, not per rpc endpoint.
+ * The reason that messages go through a path in the cluster. And we must ensure
+ * messages with the same xid do not meet at some node in the path.
+ */
 void pcs_rpc_get_new_xid(struct pcs_rpc_engine *eng, PCS_XID_T *xid)
 {
 	xid->origin = eng->local_id;
@@ -1226,6 +1232,12 @@  void pcs_rpc_engine_fini(struct pcs_rpc_engine * eng)
 	}
 }
 
+void pcs_rpc_set_local_id(struct pcs_rpc_engine *eng, PCS_NODE_ID_T *id)
+{
+	eng->local_id = *id;
+	eng->flags |= PCS_KNOWN_MYID;
+}
+
 void pcs_rpc_set_host_id(struct pcs_rpc_engine *eng, PCS_NODE_ID_T *host_id)
 {
 	eng->my_host.host_id.val = host_id->val;
diff --git a/fs/fuse/kio/pcs/pcs_rpc.h b/fs/fuse/kio/pcs/pcs_rpc.h
index 39837a74081d..b4bb99f0b3a8 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.h
+++ b/fs/fuse/kio/pcs/pcs_rpc.h
@@ -207,6 +207,7 @@  void pcs_rpc_engine_fini(struct pcs_rpc_engine * eng);
 void pcs_rpc_init_gc(struct pcs_rpc_engine * eng, unsigned int limit);
 void pcs_rpc_get_new_xid(struct pcs_rpc_engine *eng, PCS_XID_T *xid);
 
+void pcs_rpc_set_local_id(struct pcs_rpc_engine *eng, PCS_NODE_ID_T *id);
 void pcs_rpc_set_cluster_id(struct pcs_rpc_engine * eng, PCS_CLUSTER_ID_T * id);
 void pcs_rpc_set_host_id(struct pcs_rpc_engine *eng, PCS_NODE_ID_T *host_id);