Patch "gfs2: fix glock shrinker ref issues" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    gfs2: fix glock shrinker ref issues

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gfs2-fix-glock-shrinker-ref-issues.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a3762209990c77ea842a80185f68f88afb8a717e
Author: Bob Peterson <rpeterso@xxxxxxxxxx>
Date:   Tue Sep 12 08:05:51 2023 -0500

    gfs2: fix glock shrinker ref issues
    
    [ Upstream commit 62862485a4c3a52029fc30f4bdde9af04afdafc9 ]
    
    Before this patch, function gfs2_scan_glock_lru would only try to free
    glocks that had a reference count of 0. But if the reference count ever
    got to 0, the glock should have already been freed.
    
    Shrinker function gfs2_dispose_glock_lru checks whether glocks on the
    LRU are demote_ok, and if so, tries to demote them. But that's only
    possible if the reference count is at least 1.
    
    This patch changes gfs2_scan_glock_lru so it will try to demote and/or
    dispose of glocks that have a reference count of 1 and which are either
    demotable, or are already unlocked.
    
    Signed-off-by: Bob Peterson <rpeterso@xxxxxxxxxx>
    Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 1438e7465e306..59c1aed0b9b90 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -2017,7 +2017,9 @@ static long gfs2_scan_glock_lru(int nr)
 		if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
 			if (!spin_trylock(&gl->gl_lockref.lock))
 				continue;
-			if (!gl->gl_lockref.count) {
+			if (gl->gl_lockref.count <= 1 &&
+			    (gl->gl_state == LM_ST_UNLOCKED ||
+			     demote_ok(gl))) {
 				list_move(&gl->gl_lru, &dispose);
 				atomic_dec(&lru_count);
 				freed++;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux