[lustre-devel] [PATCH 131/151] lustre: ldlm: fix export reference
James Simmons
jsimmons at infradead.org
Mon Sep 30 11:56:30 PDT 2019
From: Hongchao Zhang <hongchao at whamcloud.com>
In ptlrpc_connect_interpert, the export reference could be
leaked if there is error before the following class_exp_put.
WC-bug-id: https://jira.whamcloud.com/browse/LU-10656
Lustre-commit: e52f2ea40e55 ("LU-10656 ldlm: fix export reference")
Signed-off-by: Hongchao Zhang <hongchao at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/31139
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli at ddn.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/ptlrpc/import.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c
index 152a84c..6fc0c6b 100644
--- a/fs/lustre/ptlrpc/import.c
+++ b/fs/lustre/ptlrpc/import.c
@@ -935,7 +935,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;
spin_lock(&imp->imp_lock);
@@ -1040,6 +1040,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)
goto out;
@@ -1205,6 +1207,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
imp->imp_connect_tried = 1;
spin_unlock(&imp->imp_lock);
+ if (exp)
+ class_export_put(exp);
+
if (rc != 0) {
IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
if (rc == -EACCES) {
--
1.8.3.1
More information about the lustre-devel
mailing list