]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
fs/drop_caches.c: avoid softlockups in drop_pagecache_sb()
authorJan Kara <jack@suse.cz>
Fri, 1 Feb 2019 22:21:23 +0000 (14:21 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit6b06483eacf6a4bfc206b6931e08291107e14271
treeac389734cd30d0eb3c82363400db46a3f9b804a5
parent4148b6a61f9e08392f5ff43875a9b4d9d885f8a9
fs/drop_caches.c: avoid softlockups in drop_pagecache_sb()

BugLink: https://bugs.launchpad.net/bugs/1837813
[ Upstream commit c27d82f52f75fc9d8d9d40d120d2a96fdeeada5e ]

When superblock has lots of inodes without any pagecache (like is the
case for /proc), drop_pagecache_sb() will iterate through all of them
without dropping sb->s_inode_list_lock which can lead to softlockups
(one of our customers hit this).

Fix the problem by going to the slow path and doing cond_resched() in
case the process needs rescheduling.

Link: http://lkml.kernel.org/r/20190114085343.15011-1-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/drop_caches.c