Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

LU-1092 ptlrpc: take export refcount during connect

In the process of (re)connect,  a refcount of export should be taken,
otherwise disconnect of this export may be called, and it will put
the last refcount of this export and make access to this export
invalid.

Signed-off-by: Lai Siyao <laisiyao@whamcloud.com>
Change-Id: Iaf27e842ed516b8968c90bfce396609e39f52c85
  • Loading branch information...
commit c6099f42ddb6c7ddc7d7b46611972a340a4b1b77 1 parent c8a7cb3
Lai Siyao authored morrone committed
Showing with 7 additions and 2 deletions.
  1. +7 −2 lustre/ldlm/ldlm_lib.c
View
9 lustre/ldlm/ldlm_lib.c
@@ -857,7 +857,6 @@ int target_handle_connect(struct ptlrpc_request *req)
cfs_spin_lock(&export->exp_lock);
export->exp_connecting = 1;
cfs_spin_unlock(&export->exp_lock);
- class_export_put(export);
LASSERT(export->exp_obd == target);
rc = target_handle_reconnect(&conn, export, &cluuid);
@@ -953,8 +952,12 @@ int target_handle_connect(struct ptlrpc_request *req)
rc = obd_connect(req->rq_svc_thread->t_env,
&export, target, &cluuid, data,
client_nid);
- if (rc == 0)
+ if (rc == 0) {
conn.cookie = export->exp_handle.h_cookie;
+ /* LU-1092 reconnect put export refcount in the
+ * end, connect needs take one here too. */
+ class_export_get(export);
+ }
}
} else {
rc = obd_reconnect(req->rq_svc_thread->t_env,
@@ -1125,6 +1128,8 @@ int target_handle_connect(struct ptlrpc_request *req)
cfs_spin_lock(&export->exp_lock);
export->exp_connecting = 0;
cfs_spin_unlock(&export->exp_lock);
+
+ class_export_put(export);
}
if (targref)
class_decref(targref, __FUNCTION__, cfs_current());
Please sign in to comment.
Something went wrong with that request. Please try again.