revimp->imp_remote_handle = conn;
revimp->imp_dlm_fake = 1;
revimp->imp_state = LUSTRE_IMP_FULL;
+
set_flags:
- if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_NEXT_VER) {
- /* Client wants v2 */
+ if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V1 &&
+ lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_NEXT_VER) {
revimp->imp_msg_magic = LUSTRE_MSG_MAGIC_V2;
lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_NEXT_VER);
+ } else {
+ /* unknown versions will be caught in
+ * ptlrpc_handle_server_req_in->lustre_unpack_msg() */
+ revimp->imp_msg_magic = req->rq_reqmsg->lm_magic;
+ }
+
+ if (revimp->imp_msg_magic != LUSTRE_MSG_MAGIC_V1) {
if (export->exp_connect_flags & OBD_CONNECT_AT)
revimp->imp_msghdr_flags |= MSGHDR_AT_SUPPORT;
}
class_handle_hash(&imp->imp_handle, import_handle_addref);
init_imp_at(&imp->imp_at);
- /* the default magic is V1, will be used in connect RPC, and
+ /* the default magic is V2, will be used in connect RPC, and
* then adjusted according to the flags in request/reply. */
- imp->imp_msg_magic = LUSTRE_MSG_MAGIC_V1;
+ imp->imp_msg_magic = LUSTRE_MSG_MAGIC_V2;
return imp;
}
#ifndef __KERNEL__
lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_LIBCLIENT);
#endif
- lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_NEXT_VER);
+ if (imp->imp_msg_magic == LUSTRE_MSG_MAGIC_V1)
+ lustre_msg_add_op_flags(request->rq_reqmsg,
+ MSG_CONNECT_NEXT_VER);
request->rq_send_state = LUSTRE_IMP_CONNECTING;
/* Allow a slightly larger reply for future growth compatibility */
spin_unlock(&imp->imp_lock);
}
- if (msg_flags & MSG_CONNECT_NEXT_VER) {
+ if ((request->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V1 &&
+ msg_flags & MSG_CONNECT_NEXT_VER) ||
+ request->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V2) {
imp->imp_msg_magic = LUSTRE_MSG_MAGIC_V2;
CDEBUG(D_RPCTRACE, "connect to %s with lustre_msg_v2\n",
obd2cli_tgt(imp->imp_obd));