Whamcloud - gitweb
LU-16973 ptlrpc: flush delayed file desc if idle 05/51805/6
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 29 Jul 2023 08:59:28 +0000 (02:59 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Aug 2023 05:34:59 +0000 (05:34 +0000)
commit2feb4a7bb01c5e98763a62fb0bd64edf933c95de
tree1d44f55e802ace0f4500c52fc28321135d524a65
parentd0be255ae3bdabb99e690b183801a40c05900824
LU-16973 ptlrpc: flush delayed file desc if idle

The use of alloc_file_pseudo() allocates a real file descriptor,
so fput() will use a deferred cleanup for the descriptor, either
when the thread "finishes the syscall" (which never happens for
kernel threads), or a unmount time.  This accumulates too many
file descriptors (millions) on a busy system.

Instead of waiting to cleanup these file descriptors at unmount
time, call flush_delayed_fput() to clean them up when a ptlrpcd
thread becomes idle before it goes to sleep.

For kernels 3.6 and later when flush_delayed_fput() was first added,
and before kernel 5.4 when it was EXPORT_SYMBOL'd, grab a pointer
to the function with kallsyms_lookup_name() so it can be called.

Delete LN_CONFIG_STRSCPY_EXISTS reference that generates configure
warnings, since this check was renamed and moved to libcfs.

Fixes: eed43b2a427b ("LU-13783 osd-ldiskfs: use alloc_file_pseudo to create fake files")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I24a08f9568d7d636a69672c5c3132ab25b292407
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51805
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lnet/autoconf/lustre-lnet.m4
lustre/autoconf/lustre-core.m4
lustre/ptlrpc/service.c