]> git.baikalelectronics.ru Git - kernel.git/commit
sock: allow reading and changing sk_userlocks with setsockopt
authorPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Wed, 4 Aug 2021 07:55:56 +0000 (10:55 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Aug 2021 11:52:03 +0000 (12:52 +0100)
commitca846fe15226eda4aaab8ded7fc401d435d8603b
tree4ef3056684e062829da515fa92fe7017e169f2c0
parentcb0f68c58aa1339ce17b51e408cfab3a06fadaf7
sock: allow reading and changing sk_userlocks with setsockopt

SOCK_SNDBUF_LOCK and SOCK_RCVBUF_LOCK flags disable automatic socket
buffers adjustment done by kernel (see tcp_fixup_rcvbuf() and
tcp_sndbuf_expand()). If we've just created a new socket this adjustment
is enabled on it, but if one changes the socket buffer size by
setsockopt(SO_{SND,RCV}BUF*) it becomes disabled.

CRIU needs to call setsockopt(SO_{SND,RCV}BUF*) on each socket on
restore as it first needs to increase buffer sizes for packet queues
restore and second it needs to restore back original buffer sizes. So
after CRIU restore all sockets become non-auto-adjustable, which can
decrease network performance of restored applications significantly.

CRIU need to be able to restore sockets with enabled/disabled adjustment
to the same state it was before dump, so let's add special setsockopt
for it.

Let's also export SOCK_SNDBUF_LOCK and SOCK_RCVBUF_LOCK flags to uAPI so
that using these interface one can reenable automatic socket buffer
adjustment on their sockets.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/alpha/include/uapi/asm/socket.h
arch/mips/include/uapi/asm/socket.h
arch/parisc/include/uapi/asm/socket.h
arch/sparc/include/uapi/asm/socket.h
include/net/sock.h
include/uapi/asm-generic/socket.h
include/uapi/linux/socket.h
net/core/sock.c