android_kernel_oneplus_msm8998/fs/gfs2
Ross Lagerwall 6948c6bc17 gfs2: Fix lru_count going negative
[ Upstream commit 7881ef3f33bb80f459ea6020d1e021fc524a6348 ]

Under certain conditions, lru_count may drop below zero resulting in
a large amount of log spam like this:

vmscan: shrink_slab: gfs2_dump_glock+0x3b0/0x630 [gfs2] \
    negative objects to delete nr=-1

This happens as follows:
1) A glock is moved from lru_list to the dispose list and lru_count is
   decremented.
2) The dispose function calls cond_resched() and drops the lru lock.
3) Another thread takes the lru lock and tries to add the same glock to
   lru_list, checking if the glock is on an lru list.
4) It is on a list (actually the dispose list) and so it avoids
   incrementing lru_count.
5) The glock is moved to lru_list.
5) The original thread doesn't dispose it because it has been re-added
   to the lru list but the lru_count has still decreased by one.

Fix by checking if the LRU flag is set on the glock rather than checking
if the glock is on some list and rearrange the code so that the LRU flag
is added/removed precisely when the glock is added/removed from lru_list.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-11 12:23:53 +02:00
..
acl.c
acl.h
aops.c
bmap.c gfs2: Special-case rindex for gfs2_grow 2018-09-26 08:35:05 +02:00
bmap.h
dentry.c
dir.c gfs2: avoid uninitialized variable warning 2017-04-30 05:49:28 +02:00
dir.h
export.c
file.c gfs2: Fix fallocate chunk size 2018-05-30 07:49:13 +02:00
gfs2.h
glock.c gfs2: Fix lru_count going negative 2019-06-11 12:23:53 +02:00
glock.h
glops.c
glops.h
incore.h gfs2: Fix glock rhashtable rcu bug 2017-07-15 11:57:46 +02:00
inode.c
inode.h
Kconfig
lock_dlm.c gfs2: Fix sign extension bug in gfs2_update_stats 2019-06-11 12:23:51 +02:00
log.c
log.h
lops.c
lops.h
main.c
Makefile
meta_io.c
meta_io.h
ops_fstype.c gfs2: Don't leave s_fs_info pointing to freed memory in init_sbd 2018-12-01 09:46:33 +01:00
quota.c
quota.h gfs2: Fix fallocate chunk size 2018-05-30 07:49:13 +02:00
recovery.c
recovery.h
rgrp.c gfs2: Revert "Fix loop in gfs2_rbm_find" 2019-02-06 19:43:07 +01:00
rgrp.h
super.c
super.h
sys.c
sys.h
trace_gfs2.h
trans.c
trans.h
util.c
util.h
xattr.c
xattr.h