From b3f8a2a03fa7e7f21106deb2b9960166bfef7b78 Mon Sep 17 00:00:00 2001 From: Hiroya Nozaki Date: Fri, 27 Jul 2012 18:04:46 +0900 Subject: [PATCH] LU-1682 ptlrpc: LBUG in ldlm_cli_cancel_local When the case ldlm_cli_enqueue() created a new lock, and then, fails to allocate memory for a new request, it could cause the LBUG in ldlm_cli_cancel_local() because the lock->l_conn_export is NULL, nevertheless the lock is a client-side lock. This patch fills in some lock fields before the memory allocation for a new request. Signed-off-by: Hiroya Nozaki Change-Id: I4ba4b6f1bc5dfbb51853261a0f247289304a6abd Reviewed-on: http://review.whamcloud.com/3488 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Jinshan Xiong --- lustre/ldlm/ldlm_request.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 600c3bc..48138b0 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -828,6 +828,11 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, LDLM_DEBUG(lock, "client-side enqueue START"); } + lock->l_conn_export = exp; + lock->l_export = NULL; + lock->l_blocking_ast = einfo->ei_cb_bl; + lock->l_flags |= (*flags & LDLM_FL_NO_LRU); + /* lock not sent to server yet */ if (reqp == NULL || *reqp == NULL) { @@ -853,11 +858,6 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, DLM_LOCKREQ_OFF, len, (int)sizeof(*body)); } - lock->l_conn_export = exp; - lock->l_export = NULL; - lock->l_blocking_ast = einfo->ei_cb_bl; - lock->l_flags |= (*flags & LDLM_FL_NO_LRU); - /* Dump lock data into the request buffer */ body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ); ldlm_lock2desc(lock, &body->lock_desc); -- 1.8.3.1