summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHongchao Zhang <hongchao.zhang@intel.com>2016-11-02 21:24:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-07 11:36:45 +0100
commit70519529991d2f502a5df79dfac80b006b06cd94 (patch)
treef5259816f4b558cb00de69deb23928e5338742c1 /drivers
parente4b739abf125e81022591b5557276b219d320d82 (diff)
downloadlinux-70519529991d2f502a5df79dfac80b006b06cd94.tar.bz2
staging/lustre/ldlm: fix export reference problem
1, in client_import_del_conn, the export returned from class_conn2export is not released after using it. 2, in ptlrpc_connect_interpret, the export is not released if the connect_flags isn't compatible. Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com> Reviewed-on: http://review.whamcloud.com/22031 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8500 Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Bobi Jam <bobijam@hotmail.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_lib.c3
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/import.c19
2 files changed, 13 insertions, 9 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 4f9480e5ca5b..06d3cc683917 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -170,6 +170,9 @@ int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
ptlrpc_connection_put(dlmexp->exp_connection);
dlmexp->exp_connection = NULL;
}
+
+ if (dlmexp)
+ class_export_put(dlmexp);
}
list_del(&imp_conn->oic_item);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c
index 46ba5a40fc8b..05fd92d6cf73 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/import.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
@@ -972,6 +972,16 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
spin_unlock(&imp->imp_lock);
+ if (!exp) {
+ /* This could happen if export is cleaned during the
+ * connect attempt
+ */
+ CERROR("%s: missing export after connect\n",
+ imp->imp_obd->obd_name);
+ rc = -ENODEV;
+ goto out;
+ }
+
/* check that server granted subset of flags we asked for. */
if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) !=
ocd->ocd_connect_flags) {
@@ -982,15 +992,6 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
goto out;
}
- if (!exp) {
- /* This could happen if export is cleaned during the
- * connect attempt
- */
- CERROR("%s: missing export after connect\n",
- imp->imp_obd->obd_name);
- rc = -ENODEV;
- goto out;
- }
old_connect_flags = exp_connect_flags(exp);
exp->exp_connect_data = *ocd;
imp->imp_obd->obd_self_export->exp_connect_data = *ocd;