From: Hongchao Zhang Date: Sun, 28 Jan 2018 19:25:42 +0000 (+0800) Subject: LU-10656 ldlm: fix export reference X-Git-Tag: 2.10.4-RC1~32 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=8b444bf222df5a7073ab55988cf3c270912a94e0;p=fs%2Flustre-release.git LU-10656 ldlm: fix export reference In ptlrpc_connect_interpert, the export reference could be leaked if there is error before the following class_exp_put. Lustre-change: https://review.whamcloud.com/31139 Lustre-commit: e52f2ea40e55d13b2f14fccd04959584c9022dbd Change-Id: I9ddd82fa1bbf8e17079e9746202be63e6233c052 Signed-off-by: Hongchao Zhang Reviewed-by: Andreas Dilger Reviewed-by: Li Dongyang Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/31636 Reviewed-by: Dmitry Eremin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond --- diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 65938cc..8338095 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -985,7 +985,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, __u64 old_connect_flags; int msg_flags; struct obd_connect_data *ocd; - struct obd_export *exp; + struct obd_export *exp = NULL; int ret; ENTRY; @@ -1110,6 +1110,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, rc = ptlrpc_connect_set_flags(imp, ocd, old_connect_flags, exp, aa->pcaa_initial_connect); class_export_put(exp); + exp = NULL; + if (rc != 0) GOTO(out, rc); @@ -1281,6 +1283,9 @@ out: imp->imp_connect_tried = 1; spin_unlock(&imp->imp_lock); + if (exp != NULL) + class_export_put(exp); + if (rc != 0) { IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); if (rc == -EACCES) {