@@ -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) {