Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

don't open-code kernel_accept() in rds_tcp_accept_one()

rds_tcp_accept_one() starts with a pretty much verbatim
copy of kernel_accept(). Might as well use the real thing...

That code went into mainline in 2009, kernel_accept()
had been added in Aug 2006, the copyright on rds/tcp_listen.c
is "Copyright (c) 2006 Oracle", so it's entirely possible
that it predates the introduction of kernel_accept().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://patch.msgid.link/20250713180134.GC1880847@ZenIV
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Al Viro and committed by
Jakub Kicinski
5cc7fce3 c34632db

+2 -22
+2 -22
net/rds/tcp_listen.c
··· 105 105 int conn_state; 106 106 struct rds_conn_path *cp; 107 107 struct in6_addr *my_addr, *peer_addr; 108 - struct proto_accept_arg arg = { 109 - .flags = O_NONBLOCK, 110 - .kern = true, 111 - }; 112 108 #if !IS_ENABLED(CONFIG_IPV6) 113 109 struct in6_addr saddr, daddr; 114 110 #endif ··· 113 117 if (!sock) /* module unload or netns delete in progress */ 114 118 return -ENETUNREACH; 115 119 116 - ret = sock_create_lite(sock->sk->sk_family, 117 - sock->sk->sk_type, sock->sk->sk_protocol, 118 - &new_sock); 120 + ret = kernel_accept(sock, &new_sock, O_NONBLOCK); 119 121 if (ret) 120 - goto out; 121 - 122 - ret = sock->ops->accept(sock, new_sock, &arg); 123 - if (ret < 0) 124 - goto out; 125 - 126 - /* sock_create_lite() does not get a hold on the owner module so we 127 - * need to do it here. Note that sock_release() uses sock->ops to 128 - * determine if it needs to decrement the reference count. So set 129 - * sock->ops after calling accept() in case that fails. And there's 130 - * no need to do try_module_get() as the listener should have a hold 131 - * already. 132 - */ 133 - new_sock->ops = sock->ops; 134 - __module_get(new_sock->ops->owner); 122 + return ret; 135 123 136 124 rds_tcp_keepalive(new_sock); 137 125 if (!rds_tcp_tune(new_sock)) {