From: John L. Hammond Date: Wed, 23 Jul 2014 20:08:48 +0000 (-0500) Subject: LU-5398 ldlm: handle NULL lock in ldlm_handle_enqueue0() X-Git-Tag: 2.6.51~38 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d14c3dfec382446a2f5e4e91c56d162e56563d0f LU-5398 ldlm: handle NULL lock in ldlm_handle_enqueue0() In ldlm_handle_enqueue0() if ldlm_lock_create() fails then set lock to NULL before jumping to the exit code. In the exit code test lock for NULL rather than using IS_ERR(). Signed-off-by: John L. Hammond Change-Id: I5e2680988bd5356f2a84bd5eb9e2d40138d6d250 Reviewed-on: http://review.whamcloud.com/11197 Tested-by: Jenkins Reviewed-by: Dmitry Eremin Reviewed-by: Emoly Liu Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 4d9e72f..f56c776 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1258,8 +1258,11 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns, dlm_req->lock_desc.l_resource.lr_type, dlm_req->lock_desc.l_req_mode, cbs, NULL, 0, LVB_T_NONE); - if (IS_ERR(lock)) - GOTO(out, rc = PTR_ERR(lock)); + if (IS_ERR(lock)) { + rc = PTR_ERR(lock); + lock = NULL; + GOTO(out, rc); + } lock->l_last_activity = cfs_time_current_sec(); lock->l_remote_handle = dlm_req->lock_handle[0]; @@ -1396,7 +1399,7 @@ existing_lock: /* The LOCK_CHANGED code in ldlm_lock_enqueue depends on this * ldlm_reprocess_all. If this moves, revisit that code. -phil */ - if (!IS_ERR(lock)) { + if (lock != NULL) { LDLM_DEBUG(lock, "server-side enqueue handler, sending reply" "(err=%d, rc=%d)", err, rc);