Whamcloud - gitweb
LU-5398 ldlm: handle NULL lock in ldlm_handle_enqueue0() 97/11197/3
authorJohn L. Hammond <john.hammond@intel.com>
Wed, 23 Jul 2014 20:08:48 +0000 (15:08 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 4 Aug 2014 14:50:44 +0000 (14:50 +0000)
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 <john.hammond@intel.com>
Change-Id: I5e2680988bd5356f2a84bd5eb9e2d40138d6d250
Reviewed-on: http://review.whamcloud.com/11197
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_lockd.c

index 4d9e72f..f56c776 100644 (file)
@@ -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);