gfs2: only apply DLM_LKF_VALBLK if GLOF_LVB is set
PATCH 1/1 gfs2: only apply DLM_LKF_VALBLK if GLOF_LVB is set
Currently there are cases when sb_lvbptr is NULL but gfs2 always sets the DLM_LKF_VALBLK that indicates lvb handling so sb_lvbptr should point to a user allocated lvb memory lvb. This currently makes no problems because DLM checks on sb_lvbptr being NULL when accessing sb_lvbptr and force handle it as DLM_LKF_VALBLK would not be set. This patch uses the same glock operation flag that indicates lvb handling to set DLM_LKF_VALBLK instead of always setting it as this is against DLM API.
--- fs/gfs2/lock_dlm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/gfs2/lock_dlm.c +5 -1
@@ -328,6 +328,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl) {struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;struct lm_lockstruct *ls = &sdp->sd_lockstruct; +uint32_t flags =0 ;int error;BUG_ON (!__lockref_is_dead (&gl->gl_lockref));
@@ -361,8 +362,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl)return ; } +if (gl->gl_ops->go_flags &GLOF_LVB ) + flags =DLM_LKF_VALBLK ; + 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, flags,NULL , gl);if (error == -EBUSY ) {msleep (20 );
Signature · 1 line
2.43.0
Andreas Gruenbacher
maintainerQuoted 27 lines · Alexander Aring
Currently there are cases when
sb_lvbptris NULL but gfs2 always sets theDLM_LKF_VALBLKthat indicates lvb handling sosb_lvbptrshould point to a user allocated lvb memory lvb. This currently makes no problems because DLM checks onsb_lvbptrbeing NULL when accessingsb_lvbptrand force handle it asDLM_LKF_VALBLKwould not be set. This patch uses the same glock operation flag that indicates lvb handling to setDLM_LKF_VALBLKinstead of always setting it as this is against DLM API.Signed-off-by Alexander Aring <[email protected]>--- fs/gfs2/lock_dlm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)fs/gfs2/lock_dlm.c +1
-0@@ -328,6 +328,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl) {struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;struct lm_lockstruct *ls = &sdp->sd_lockstruct; +uint32_t flags =0 ;int error;BUG_ON (!__lockref_is_dead (&gl->gl_lockref));
fs/gfs2/lock_dlm.c static void gdlm_put_lock(struct gfs2_glock *gl) · line 366
Quoted 5 lines
fs/gfs2/lock_dlm.c +2
-0@@ -361,8 +362,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl)return ; } +if (gl->gl_ops->go_flags &GLOF_LVB ) + flags =DLM_LKF_VALBLK ;
Let me change that as follows because this is the check fs/gfs2/lock_dlm.c uses in other places already:
if (gl->gl_lksb.sb_lvbptr)
flags |= DLM_LKF_VALBLK;Quoted 9 lines
fs/gfs2/lock_dlm.c +2
-2+ 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, flags,NULL , gl);if (error == -EBUSY ) {msleep (20 ); --2.43.0
Thanks,
Andreas