From 1bdc4fd0594e8948623bde18e7b5d691104d8808 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Fri, 5 Dec 2014 00:58:06 +0800 Subject: [PATCH] LU-6307 obdclass: distinguish MGC/MDT connection properly In the 5f8847bca12afb798de600299356ed2e3655a53e, we introduced the version checking for the MDT-MDT connection. But there is a corner that the MGC will set OBD_CONNECT_MNE_SWAB (that is defined as the same as OBD_CONNECT_MDS_MDS) in the connection flags for Imperative Recovery interoperability issues with MGS. So the server needs to know whether the connection is really from another MDT or from the MGC via checking OBD_CONNECT_FID (that is not set for the MGC-MGS connection). Test-Parameters: envdefinitions=ONLY=105 clientjob=lustre-b2_6 clientbuildno=19 testlist=recovery-small Signed-off-by: Fan Yong Change-Id: I9cee743d5474702b77adbb8c3dedd6c19faef15f Reviewed-on: http://review.whamcloud.com/13927 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/ldlm/ldlm_lib.c | 8 ++++++-- lustre/ptlrpc/import.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 5e1f170..14a0ac7 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -902,10 +902,14 @@ int target_handle_connect(struct ptlrpc_request *req) OBD_CONNECT_LIGHTWEIGHT) != 0; /* OBD_CONNECT_MNE_SWAB is defined as OBD_CONNECT_MDS_MDS - * for Imperative Recovery connection from MGC to MGS. */ + * for Imperative Recovery connection from MGC to MGS. + * + * Via check OBD_CONNECT_FID, we can distinguish whether + * the OBD_CONNECT_MDS_MDS/OBD_CONNECT_MNE_SWAB is from + * MGC or MDT. */ if (!lw_client && (data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) && - !(data->ocd_connect_flags & OBD_CONNECT_IMP_RECOV) && + (data->ocd_connect_flags & OBD_CONNECT_FID) && (data->ocd_connect_flags & OBD_CONNECT_VERSION)) { __u32 major = OBD_OCD_VERSION_MAJOR(data->ocd_version); __u32 minor = OBD_OCD_VERSION_MINOR(data->ocd_version); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 5d1e6b8..4185eff 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -1016,7 +1016,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, if (!(imp->imp_connect_flags_orig & OBD_CONNECT_LIGHTWEIGHT) && (imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS) && - !(imp->imp_connect_flags_orig & OBD_CONNECT_IMP_RECOV) && + (imp->imp_connect_flags_orig & OBD_CONNECT_FID) && (ocd->ocd_connect_flags & OBD_CONNECT_VERSION)) { __u32 major = OBD_OCD_VERSION_MAJOR(ocd->ocd_version); __u32 minor = OBD_OCD_VERSION_MINOR(ocd->ocd_version); -- 1.8.3.1