]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gfs2: Remove DLM_LKF_ALTCW / DLM_LKF_ALTPR code
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 7 Aug 2025 08:21:33 +0000 (10:21 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 12 Sep 2025 10:02:25 +0000 (12:02 +0200)
Commit 6802e3400ff45 ("[GFS2] Clean up the glock core") stopped passing
the LM_FLAG_ANY flag down to gdlm_lock() (then gfs2_lm_lock()).  Since
then, gfs2 effectively hasn't been using dlm's DLM_LKF_ALTCW /
DLM_LKF_ALTPR flags, but the code still suggests that it does.  Recent
testing shows that those flags don't even work reliably anymore, so
instead of fixing code that hasn't been used since 2008, remove it.

In addition, clean up how the flags are passed to [gd]lm_lock().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Andrew Price <anprice@redhat.com>
fs/gfs2/glock.c
fs/gfs2/lock_dlm.c

index 5958910154158e0a014182a4f8bbec4b92320684..6294a9f36318901f73af369caff5690368a2133b 100644 (file)
@@ -695,14 +695,12 @@ __acquires(&gl->gl_lockref.lock)
        const struct gfs2_glock_operations *glops = gl->gl_ops;
        struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
        struct lm_lockstruct *ls = &sdp->sd_lockstruct;
-       unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0);
        int ret;
 
        if (target != LM_ST_UNLOCKED && glock_blocked_by_withdraw(gl) &&
            gh && !(gh->gh_flags & LM_FLAG_NOEXP))
                goto skip_inval;
 
-       lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP);
        GLOCK_BUG_ON(gl, gl->gl_state == target);
        GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target);
        if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) &&
@@ -809,7 +807,7 @@ skip_inval:
        if (ls->ls_ops->lm_lock) {
                set_bit(GLF_PENDING_REPLY, &gl->gl_flags);
                spin_unlock(&gl->gl_lockref.lock);
-               ret = ls->ls_ops->lm_lock(gl, target, lck_flags);
+               ret = ls->ls_ops->lm_lock(gl, target, gh ? gh->gh_flags : 0);
                spin_lock(&gl->gl_lockref.lock);
 
                if (!ret) {
index 5daaeaaaf18dd869e108ba2ece817732e0d58927..427150a206cfe37f2b21c8f8a5eadaa91c0e52bd 100644 (file)
@@ -162,14 +162,6 @@ static void gdlm_ast(void *arg)
        }
 
        ret = gl->gl_req;
-       if (gl->gl_lksb.sb_flags & DLM_SBF_ALTMODE) {
-               if (gl->gl_req == LM_ST_SHARED)
-                       ret = LM_ST_DEFERRED;
-               else if (gl->gl_req == LM_ST_DEFERRED)
-                       ret = LM_ST_SHARED;
-               else
-                       BUG();
-       }
 
        /*
         * The GLF_INITIAL flag is initially set for new glocks.  Upon the
@@ -261,15 +253,6 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
                lkf |= DLM_LKF_NOQUEUEBAST;
        }
 
-       if (gfs_flags & LM_FLAG_ANY) {
-               if (req == DLM_LOCK_PR)
-                       lkf |= DLM_LKF_ALTCW;
-               else if (req == DLM_LOCK_CW)
-                       lkf |= DLM_LKF_ALTPR;
-               else
-                       BUG();
-       }
-
        if (!test_bit(GLF_INITIAL, &gl->gl_flags)) {
                lkf |= DLM_LKF_CONVERT;