Skip to content

Commit ff22e5d

Browse files
Alexander AringAndreas Gruenbacher
authored andcommitted
gfs2: only apply DLM_LKF_VALBLK if sb_lvbptr is not NULL
Currently, gfs2 always sets the DLM_LKF_VALBLK flag to enable lvb handling even when sb_lvbptr is NULL. This currently causes no problems because DLM ignores the DLM_LKF_VALBLK flag when sb_lvbptr is NULL, but it does violate the DLM API. Fix that by only setting DLM_LKF_VALBLK when sb_lvbptr is not NULL. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent ac5ee08 commit ff22e5d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/gfs2/lock_dlm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
328328
{
329329
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
330330
struct lm_lockstruct *ls = &sdp->sd_lockstruct;
331+
uint32_t flags = 0;
331332
int error;
332333

333334
BUG_ON(!__lockref_is_dead(&gl->gl_lockref));
@@ -352,7 +353,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
352353
* When the lockspace is released, all remaining glocks will be
353354
* unlocked automatically. This is more efficient than unlocking them
354355
* individually, but when the lock is held in DLM_LOCK_EX or
355-
* DLM_LOCK_PW mode, the lock value block (LVB) will be lost.
356+
* DLM_LOCK_PW mode, the lock value block (LVB) would be lost.
356357
*/
357358

358359
if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
@@ -361,8 +362,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
361362
return;
362363
}
363364

365+
if (gl->gl_lksb.sb_lvbptr)
366+
flags |= DLM_LKF_VALBLK;
367+
364368
again:
365-
error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK,
369+
error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, flags,
366370
NULL, gl);
367371
if (error == -EBUSY) {
368372
msleep(20);

0 commit comments

Comments
 (0)