]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vfs: fix vnlru marker handling for filtered/unfiltered cases
authorMateusz Guzik <mjg@FreeBSD.org>
Wed, 17 Mar 2021 21:33:47 +0000 (22:33 +0100)
committerMateusz Guzik <mjg@FreeBSD.org>
Thu, 18 Mar 2021 15:36:22 +0000 (15:36 +0000)
commitfaa41af1fed350327cc542cb240ca2c6e1e8ba0c
tree00da8abb740a91dc1070ada59ff63a14d3145c04
parent4c6c8f51fdb7e2b3870ec5a6fa5dce51ad3b25a5
vfs: fix vnlru marker handling for filtered/unfiltered cases

The global list has a marker with an invariant that free vnodes are
placed somewhere past that. A caller which performs filtering (like ZFS)
can move said marker all the way to the end, across free vnodes which
don't match. Then a caller which does not perform filtering will fail to
find them. This makes vn_alloc_hard sleep for 1 second instead of
reclaiming, resulting in significant stalls.

Fix the problem by requiring an explicit marker by callers which do
filtering.

As a temporary measure extend vnlru_free to restart if it fails to
reclaim anything.

Big thanks go to the reporter for testing several iterations of the
patch.

Reported by: Yamagi <lists yamagi.org>
Tested by: Yamagi <lists yamagi.org>
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D29324
Approved by: re (gjb)

(cherry picked from commit e9272225e6bed840b00eef1c817b188c172338ee)
sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c
sys/kern/vfs_subr.c
sys/sys/vnode.h