Commit a9b0f6f4 authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher

gfs2: simplify gdlm_put_lock with out_free label

This patch introduces a new out_free label and consolidates the three
places function gdlm_put_lock freed the glock.  No change in
functionality.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 0bdd0f0b
...@@ -296,10 +296,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl) ...@@ -296,10 +296,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
struct lm_lockstruct *ls = &sdp->sd_lockstruct; struct lm_lockstruct *ls = &sdp->sd_lockstruct;
int error; int error;
if (gl->gl_lksb.sb_lkid == 0) { if (gl->gl_lksb.sb_lkid == 0)
gfs2_glock_free(gl); goto out_free;
return;
}
clear_bit(GLF_BLOCKING, &gl->gl_flags); clear_bit(GLF_BLOCKING, &gl->gl_flags);
gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT); gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT);
...@@ -307,17 +305,13 @@ static void gdlm_put_lock(struct gfs2_glock *gl) ...@@ -307,17 +305,13 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
gfs2_update_request_times(gl); gfs2_update_request_times(gl);
/* don't want to call dlm if we've unmounted the lock protocol */ /* don't want to call dlm if we've unmounted the lock protocol */
if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) { if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags))
gfs2_glock_free(gl); goto out_free;
return;
}
/* don't want to skip dlm_unlock writing the lvb when lock has one */ /* don't want to skip dlm_unlock writing the lvb when lock has one */
if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
!gl->gl_lksb.sb_lvbptr) { !gl->gl_lksb.sb_lvbptr)
gfs2_glock_free(gl); goto out_free;
return;
}
again: again:
error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK, error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
...@@ -331,8 +325,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl) ...@@ -331,8 +325,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
fs_err(sdp, "gdlm_unlock %x,%llx err=%d\n", fs_err(sdp, "gdlm_unlock %x,%llx err=%d\n",
gl->gl_name.ln_type, gl->gl_name.ln_type,
(unsigned long long)gl->gl_name.ln_number, error); (unsigned long long)gl->gl_name.ln_number, error);
return;
} }
return;
out_free:
gfs2_glock_free(gl);
} }
static void gdlm_cancel(struct gfs2_glock *gl) static void gdlm_cancel(struct gfs2_glock *gl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment