summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-handshake.c6
-rw-r--r--xlators/protocol/server/src/server-handshake.c18
-rw-r--r--xlators/protocol/server/src/server-messages.h11
-rw-r--r--xlators/protocol/server/src/server.c8
4 files changed, 42 insertions, 1 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index adccd8d..354b916 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -1387,6 +1387,12 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
"msg", client_get_lk_ver (conf));
}
+ ret = dict_set_int32 (options, "opversion", GD_OP_VERSION_MAX);
+ if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "Failed to set client opversion in handshake message");
+ }
+
ret = dict_serialized_length (options);
if (ret < 0) {
gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 1230cdf..a33efb8 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -431,6 +431,8 @@ server_setvolume (rpcsvc_request_t *req)
uint32_t lk_version = 0;
char *buf = NULL;
gf_boolean_t cancelled = _gf_false;
+ uint32_t opversion = 0;
+ rpc_transport_t *xprt = NULL;
params = dict_new ();
reply = dict_new ();
@@ -669,6 +671,22 @@ server_setvolume (rpcsvc_request_t *req)
gf_msg_debug (this->name, 0, "failed to set "
"peer-info");
}
+
+ ret = dict_get_uint32 (params, "opversion", &opversion);
+ if (ret)
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_CLIENT_OPVERSION_GET_FAILED,
+ "Failed to get client opversion");
+
+ /* Assign op-version value to the client */
+ pthread_mutex_lock (&conf->mutex);
+ list_for_each_entry (xprt, &conf->xprt_list, list) {
+ if (strcmp (peerinfo->identifier, xprt->peerinfo.identifier))
+ continue;
+ xprt->peerinfo.max_op_version = opversion;
+ }
+ pthread_mutex_unlock (&conf->mutex);
+
if (conf->auth_modules == NULL) {
gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
"Authentication module not initialized");
diff --git a/xlators/protocol/server/src/server-messages.h b/xlators/protocol/server/src/server-messages.h
index 5593e68..b8245af 100644
--- a/xlators/protocol/server/src/server-messages.h
+++ b/xlators/protocol/server/src/server-messages.h
@@ -40,7 +40,7 @@
*/
#define GLFS_PS_BASE GLFS_MSGID_COMP_PS
-#define GLFS_NUM_MESSAGES 90
+#define GLFS_NUM_MESSAGES 91
#define GLFS_MSGID_END (GLFS_PS_BASE + GLFS_NUM_MESSAGES + 1)
/* Messages with message IDs */
#define glfs_msg_start_x GLFS_PS_BASE, "Invalid: Start of messages"
@@ -848,6 +848,15 @@
*/
#define PS_MSG_COMPOUND_INFO (GLFS_PS_BASE + 90)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CLIENT_OPVERSION_GET_FAILED (GLFS_PS_BASE + 91)
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index af3adb3..db2f06a 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -275,6 +275,14 @@ server_priv_to_dict (xlator_t *this, dict_t *dict)
if (ret)
goto unlock;
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "client%d.opversion",
+ count);
+ ret = dict_set_uint32 (dict, key,
+ peerinfo->max_op_version);
+ if (ret)
+ goto unlock;
+
count++;
}
}