[PATCH] fs:gfs:glock: Delete the invalid pointer insert_pt in add_to_queue()

Chaohai Chen posted 1 patch 7 months, 4 weeks ago
fs/gfs2/glock.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
[PATCH] fs:gfs:glock: Delete the invalid pointer insert_pt in add_to_queue()
Posted by Chaohai Chen 7 months, 4 weeks ago
The point insert_pt is always NULL, no one will change it, delete the code
and useless logic about it.

Signed-off-by: Chaohai Chen <wdhh6@aliyun.com>
---
 fs/gfs2/glock.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 65c07aa95718..8a0f2140b9b3 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1483,7 +1483,6 @@ __acquires(&gl->gl_lockref.lock)
 {
 	struct gfs2_glock *gl = gh->gh_gl;
 	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
-	struct list_head *insert_pt = NULL;
 	struct gfs2_holder *gh2;
 	int try_futile = 0;
 
@@ -1525,15 +1524,7 @@ __acquires(&gl->gl_lockref.lock)
 	trace_gfs2_glock_queue(gh, 1);
 	gfs2_glstats_inc(gl, GFS2_LKS_QCOUNT);
 	gfs2_sbstats_inc(gl, GFS2_LKS_QCOUNT);
-	if (likely(insert_pt == NULL)) {
-		list_add_tail(&gh->gh_list, &gl->gl_holders);
-		return;
-	}
-	list_add_tail(&gh->gh_list, insert_pt);
-	spin_unlock(&gl->gl_lockref.lock);
-	if (sdp->sd_lockstruct.ls_ops->lm_cancel)
-		sdp->sd_lockstruct.ls_ops->lm_cancel(gl);
-	spin_lock(&gl->gl_lockref.lock);
+	list_add_tail(&gh->gh_list, &gl->gl_holders);
 	return;
 
 trap_recursive:
-- 
2.34.1
Re: [PATCH] fs:gfs:glock: Delete the invalid pointer insert_pt in add_to_queue()
Posted by Andreas Gruenbacher 7 months, 4 weeks ago
Hello,

On Sat, Apr 19, 2025 at 8:54 AM Chaohai Chen <wdhh6@aliyun.com> wrote:
> The point insert_pt is always NULL, no one will change it, delete the code
> and useless logic about it.

the code in question has already been removed in commit 0360faca5d4d
("gfs2: Remove more dead code in add_to_queue").

Please always check the for-next branch of
git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git
before sending patches. In this case though, the fix has even been
merged into mainline already.

Thanks,
Andreas