From: Andreas Gruenbacher Date: Mon, 4 Aug 2025 23:58:47 +0000 (+0200) Subject: gfs2: Do not use atomic operations unnecessarily X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd718046646593ced5ad98f9cde22aaf2a2eb8f2;p=thirdparty%2Fkernel%2Fstable.git gfs2: Do not use atomic operations unnecessarily The GLF_DEMOTE_IN_PROGRESS and GLF_LOCK flags and the glock refcount are all protected by the glock spin lock, so there is no need for atomic operations / barriers here. Signed-off-by: Andreas Gruenbacher Reviewed-by: Andrew Price --- diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 5bdb11de5b132..1ced38b9a5a25 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -646,8 +646,10 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret) } /* Fast path - we got what we asked for */ - if (test_and_clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) + if (test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) { + clear_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags); gfs2_demote_wake(gl); + } if (gl->gl_state != LM_ST_UNLOCKED) { if (glops->go_xmote_bh) { int rv; @@ -891,14 +893,12 @@ __acquires(&gl->gl_lockref.lock) out_sched: clear_bit(GLF_LOCK, &gl->gl_flags); - smp_mb__after_atomic(); gl->gl_lockref.count++; gfs2_glock_queue_work(gl, 0); return; out_unlock: clear_bit(GLF_LOCK, &gl->gl_flags); - smp_mb__after_atomic(); } /**