On 22/11/2023 11:10 pm, Cedric Blancher wrote:
On Thu, 23 Nov 2023 at 00:03, Calum Mackay <calum.mackay@xxxxxxxxxx> wrote:hi Ced, On 22/11/2023 10:48 pm, Cedric Blancher wrote:On Mon, 20 Nov 2023 at 03:57, Olga Kornievskaia <aglo@xxxxxxxxx> wrote:Hi Ced, Why do you think it doesn't use it? Have you looked at a network trace of an idle connection? I seem to recall seeing keep-alive being used.Well, I don't see a setsockopt(TCP_KEEPALIVE) in the libtirpc code?We have this, in the kernel RPC code: https://elixir.bootlin.com/linux/latest/source/net/sunrpc/xprtsock.c#L2257 which might be it.Yay, But how does the kernel get the fd from libtirpc? Also, how can I turn this: /* TCP Keepalive options */ sock_set_keepalive(sock->sk); tcp_sock_set_keepidle(sock->sk, keepidle); tcp_sock_set_keepintvl(sock->sk, keepidle); tcp_sock_set_keepcnt(sock->sk, keepcnt); /* TCP user timeout (see RFC5482) */ tcp_sock_set_user_timeout(sock->sk, timeo); into setsockopt() from userland code? Does the BSD socket library have such options?
What's the userland aspect here? For NFS, the kernel RPC code owns the socket, and sets the sock options.
You can see whether TCP keepalive is enabled, with the final column of netstat output:
getz $ netstat -neopa | grep :2049 …tcp 0 0 192.168.254.2:49802 192.168.254.7:2049 TIME_WAIT 0 0 - timewait (37.52/0/0) tcp 0 0 192.168.254.2:722 192.168.254.7:2049 TIME_WAIT 0 0 - timewait (37.52/0/0) tcp 0 0 192.168.254.2:979 192.168.254.7:2049 ESTABLISHED 0 35214 - keepalive (8.47/0/0)
cheers, calum.
Cedcheers, calum.CedOn Fri, Nov 17, 2023 at 8:02 PM Cedric Blancher <cedric.blancher@xxxxxxxxx> wrote:Good morning! Why does the Linux NFS client not use TCP_KEEPALIVE for its TCP connections? What are the pro and cons of using that for NFS TCP connections? Ced -- Cedric Blancher <cedric.blancher@xxxxxxxxx> [https://plus.google.com/u/0/+CedricBlancher/] Institute Pasteur-- Calum Mackay Linux Kernel Engineering Oracle Linux and Virtualisation
-- Calum Mackay Linux Kernel Engineering Oracle Linux and Virtualisation
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature