gfs2: Fix "Make glock lru list scanning safer"
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 28 Mar 2024 18:59:45 +0000 (19:59 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Apr 2024 16:35:58 +0000 (18:35 +0200)
commitacf1f42faf5a27913eb7b8140cc255f1b3d14e48
treed97bfcde676deba771c9141a6ad1098bc9b33e0d
parentc9a0a4b028e4fe16c79e685b2135ce2f097d0d0e
gfs2: Fix "Make glock lru list scanning safer"

Commit 228804a35caa tried to add a refcount check to
gfs2_scan_glock_lru() to make sure that glocks that are still referenced
cannot be freed.  It failed to account for the bias state_change() adds
to the refcount for held glocks, so held glocks are no longer removed
from the glock cache, which can lead to out-of-memory problems.  Fix
that.  (The inodes those glocks are associated with do get shrunk and do
get pushed out of memory.)

In addition, use the same eligibility check in gfs2_scan_glock_lru() and
gfs2_dispose_glock_lru().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c