Whamcloud - gitweb
LU-1682 ptlrpc: LBUG in ldlm_cli_cancel_local
authorHiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Fri, 27 Jul 2012 09:04:46 +0000 (18:04 +0900)
committerOleg Drokin <green@whamcloud.com>
Tue, 31 Jul 2012 14:50:02 +0000 (10:50 -0400)
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 <nozaki.hiroya@jp.fujitsu.com>
Change-Id: I4ba4b6f1bc5dfbb51853261a0f247289304a6abd
Reviewed-on: http://review.whamcloud.com/3488
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
lustre/ldlm/ldlm_request.c

index 600c3bc..48138b0 100644 (file)
@@ -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);