Whamcloud - gitweb
LU-16973 ptlrpc: flush delayed file desc if idle
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 5 Jul 2023 00:09:24 +0000 (08:09 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 21 Aug 2023 08:46:53 +0000 (08:46 +0000)
commitf36d968b6ed9ffe230a0a513729d4ffe831f8e64
tree0ad9fdf26544f029dba19e52fddce0912c918bd1
parent8e67a91d5df5a27f55039d3824f974408462d278
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 5.3 and later when flush_delayed_fput() was first added,
and before kernel 5.6 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.

Lustre-change: https://review.whamcloud.com/51805
Lustre-change: 2feb4a7bb01c5e98763a62fb0bd64edf933c95de

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/ex/lustre-release/+/51813
Tested-by: Shuichi Ihara <sihara@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/ptlrpc/service.c