Skip to content

Commit a9b0f6f

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
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: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 0bdd0f0 commit a9b0f6f

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

fs/gfs2/lock_dlm.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -296,28 +296,22 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
296296
struct lm_lockstruct *ls = &sdp->sd_lockstruct;
297297
int error;
298298

299-
if (gl->gl_lksb.sb_lkid == 0) {
300-
gfs2_glock_free(gl);
301-
return;
302-
}
299+
if (gl->gl_lksb.sb_lkid == 0)
300+
goto out_free;
303301

304302
clear_bit(GLF_BLOCKING, &gl->gl_flags);
305303
gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT);
306304
gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
307305
gfs2_update_request_times(gl);
308306

309307
/* don't want to call dlm if we've unmounted the lock protocol */
310-
if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) {
311-
gfs2_glock_free(gl);
312-
return;
313-
}
308+
if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags))
309+
goto out_free;
314310
/* don't want to skip dlm_unlock writing the lvb when lock has one */
315311

316312
if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
317-
!gl->gl_lksb.sb_lvbptr) {
318-
gfs2_glock_free(gl);
319-
return;
320-
}
313+
!gl->gl_lksb.sb_lvbptr)
314+
goto out_free;
321315

322316
again:
323317
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)
331325
fs_err(sdp, "gdlm_unlock %x,%llx err=%d\n",
332326
gl->gl_name.ln_type,
333327
(unsigned long long)gl->gl_name.ln_number, error);
334-
return;
335328
}
329+
return;
330+
331+
out_free:
332+
gfs2_glock_free(gl);
336333
}
337334

338335
static void gdlm_cancel(struct gfs2_glock *gl)

0 commit comments

Comments
 (0)