Commit 70519529 authored by Hongchao Zhang's avatar Hongchao Zhang Committed by Greg Kroah-Hartman

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: default avatarHongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/22031
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8500Reviewed-by: default avatarJames Simmons <uja.ornl@yahoo.com>
Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e4b739ab
...@@ -170,6 +170,9 @@ int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid) ...@@ -170,6 +170,9 @@ int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
ptlrpc_connection_put(dlmexp->exp_connection); ptlrpc_connection_put(dlmexp->exp_connection);
dlmexp->exp_connection = NULL; dlmexp->exp_connection = NULL;
} }
if (dlmexp)
class_export_put(dlmexp);
} }
list_del(&imp_conn->oic_item); list_del(&imp_conn->oic_item);
......
...@@ -972,6 +972,16 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, ...@@ -972,6 +972,16 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
spin_unlock(&imp->imp_lock); 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. */ /* check that server granted subset of flags we asked for. */
if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) != if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) !=
ocd->ocd_connect_flags) { ocd->ocd_connect_flags) {
...@@ -982,15 +992,6 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, ...@@ -982,15 +992,6 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
goto out; 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); old_connect_flags = exp_connect_flags(exp);
exp->exp_connect_data = *ocd; exp->exp_connect_data = *ocd;
imp->imp_obd->obd_self_export->exp_connect_data = *ocd; imp->imp_obd->obd_self_export->exp_connect_data = *ocd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment