Message ID | 20210803082553.25194-1-yajun.deng@linux.dev (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: Modify sock_set_keepalive() for more scenarios | expand |
On 8/3/21, Yajun Deng <yajun.deng@linux.dev> wrote: > Add 2nd parameter in sock_set_keepalive(), let the caller decide > whether to set. This can be applied to more scenarios. It makes sense to send the patch within a context of other scenarios > > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > --- > include/net/sock.h | 2 +- > net/core/filter.c | 4 +--- > net/core/sock.c | 10 ++++------ > net/mptcp/sockopt.c | 4 +--- > net/rds/tcp_listen.c | 2 +- > net/smc/af_smc.c | 2 +- > net/sunrpc/xprtsock.c | 2 +- > 7 files changed, 10 insertions(+), 16 deletions(-) > > diff --git a/include/net/sock.h b/include/net/sock.h > index ff1be7e7e90b..0aae26159549 100644 > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -2772,7 +2772,7 @@ int sock_set_timestamping(struct sock *sk, int > optname, > > void sock_enable_timestamps(struct sock *sk); > void sock_no_linger(struct sock *sk); > -void sock_set_keepalive(struct sock *sk); > +void sock_set_keepalive(struct sock *sk, bool valbool); > void sock_set_priority(struct sock *sk, u32 priority); > void sock_set_rcvbuf(struct sock *sk, int val); > void sock_set_mark(struct sock *sk, u32 val); > diff --git a/net/core/filter.c b/net/core/filter.c > index faf29fd82276..41b2bf140b89 100644 > --- a/net/core/filter.c > +++ b/net/core/filter.c > @@ -4769,9 +4769,7 @@ static int _bpf_setsockopt(struct sock *sk, int level, > int optname, > ret = sock_bindtoindex(sk, ifindex, false); > break; > case SO_KEEPALIVE: > - if (sk->sk_prot->keepalive) > - sk->sk_prot->keepalive(sk, valbool); > - sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); > + sock_set_keepalive(sk, !!valbool); > break; > case SO_REUSEPORT: > sk->sk_reuseport = valbool; > diff --git a/net/core/sock.c b/net/core/sock.c > index 9671c32e6ef5..7041e6355ae1 100644 > --- a/net/core/sock.c > +++ b/net/core/sock.c > @@ -892,12 +892,12 @@ int sock_set_timestamping(struct sock *sk, int > optname, > return 0; > } > > -void sock_set_keepalive(struct sock *sk) > +void sock_set_keepalive(struct sock *sk, bool valbool) > { > lock_sock(sk); > if (sk->sk_prot->keepalive) > - sk->sk_prot->keepalive(sk, true); > - sock_valbool_flag(sk, SOCK_KEEPOPEN, true); > + sk->sk_prot->keepalive(sk, valbool); > + sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); > release_sock(sk); > } > EXPORT_SYMBOL(sock_set_keepalive); > @@ -1060,9 +1060,7 @@ int sock_setsockopt(struct socket *sock, int level, > int optname, > break; > > case SO_KEEPALIVE: > - if (sk->sk_prot->keepalive) > - sk->sk_prot->keepalive(sk, valbool); > - sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); > + sock_set_keepalive(sk, !!valbool); > break; > > case SO_OOBINLINE: > diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c > index 8c03afac5ca0..879b8381055c 100644 > --- a/net/mptcp/sockopt.c > +++ b/net/mptcp/sockopt.c > @@ -81,9 +81,7 @@ static void mptcp_sol_socket_sync_intval(struct mptcp_sock > *msk, int optname, in > sock_valbool_flag(ssk, SOCK_DBG, !!val); > break; > case SO_KEEPALIVE: > - if (ssk->sk_prot->keepalive) > - ssk->sk_prot->keepalive(ssk, !!val); > - sock_valbool_flag(ssk, SOCK_KEEPOPEN, !!val); > + sock_set_keepalive(ssk, !!val); > break; > case SO_PRIORITY: > ssk->sk_priority = val; > diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c > index 09cadd556d1e..b69ebb3f424a 100644 > --- a/net/rds/tcp_listen.c > +++ b/net/rds/tcp_listen.c > @@ -44,7 +44,7 @@ void rds_tcp_keepalive(struct socket *sock) > int keepidle = 5; /* send a probe 'keepidle' secs after last data */ > int keepcnt = 5; /* number of unack'ed probes before declaring dead */ > > - sock_set_keepalive(sock->sk); > + sock_set_keepalive(sock->sk, true); > tcp_sock_set_keepcnt(sock->sk, keepcnt); > tcp_sock_set_keepidle(sock->sk, keepidle); > /* KEEPINTVL is the interval between successive probes. We follow > diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c > index 898389611ae8..ad8f4302037f 100644 > --- a/net/smc/af_smc.c > +++ b/net/smc/af_smc.c > @@ -68,7 +68,7 @@ static void smc_set_keepalive(struct sock *sk, int val) > { > struct smc_sock *smc = smc_sk(sk); > > - smc->clcsock->sk->sk_prot->keepalive(smc->clcsock->sk, val); > + sock_set_keepalive(smc->clcsock->sk, !!val); > } > > static struct smc_hashinfo smc_v4_hashinfo = { > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c > index e573dcecdd66..306a332f8d28 100644 > --- a/net/sunrpc/xprtsock.c > +++ b/net/sunrpc/xprtsock.c > @@ -2127,7 +2127,7 @@ static void xs_tcp_set_socket_timeouts(struct rpc_xprt > *xprt, > spin_unlock(&xprt->transport_lock); > > /* TCP Keepalive options */ > - sock_set_keepalive(sock->sk); > + sock_set_keepalive(sock->sk, true); > tcp_sock_set_keepidle(sock->sk, keepidle); > tcp_sock_set_keepintvl(sock->sk, keepidle); > tcp_sock_set_keepcnt(sock->sk, keepcnt); > -- > 2.32.0 > >
Hi Yajun,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Yajun-Deng/net-Modify-sock_set_keepalive-for-more-scenarios/20210803-162757
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7cdd0a89ec70ce6a720171f1f7817ee9502b134c
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1dd4cca54718feb13bbafafb8104a414ddc49662
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yajun-Deng/net-Modify-sock_set_keepalive-for-more-scenarios/20210803-162757
git checkout 1dd4cca54718feb13bbafafb8104a414ddc49662
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash fs/dlm/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
fs/dlm/lowcomms.c: In function 'tcp_create_listen_sock':
>> fs/dlm/lowcomms.c:1359:2: error: too few arguments to function 'sock_set_keepalive'
1359 | sock_set_keepalive(sock->sk);
| ^~~~~~~~~~~~~~~~~~
In file included from fs/dlm/lowcomms.c:46:
include/net/sock.h:2775:6: note: declared here
2775 | void sock_set_keepalive(struct sock *sk, bool valbool);
| ^~~~~~~~~~~~~~~~~~
vim +/sock_set_keepalive +1359 fs/dlm/lowcomms.c
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1319
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1320 /* On error caller must run dlm_close_sock() for the
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1321 * listen connection socket.
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1322 */
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1323 static int tcp_create_listen_sock(struct listen_connection *con,
ac33d071059557 fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-12-06 1324 struct sockaddr_storage *saddr)
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1325 {
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1326 struct socket *sock = NULL;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1327 int result = 0;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1328 int addr_len;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1329
6ed7257b46709e fs/dlm/lowcomms.c Patrick Caulfield 2007-04-17 1330 if (dlm_local_addr[0]->ss_family == AF_INET)
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1331 addr_len = sizeof(struct sockaddr_in);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1332 else
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1333 addr_len = sizeof(struct sockaddr_in6);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1334
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1335 /* Create a socket to communicate with */
eeb1bd5c40edb0 fs/dlm/lowcomms.c Eric W. Biederman 2015-05-08 1336 result = sock_create_kern(&init_net, dlm_local_addr[0]->ss_family,
eeb1bd5c40edb0 fs/dlm/lowcomms.c Eric W. Biederman 2015-05-08 1337 SOCK_STREAM, IPPROTO_TCP, &sock);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1338 if (result < 0) {
617e82e10ccf96 fs/dlm/lowcomms.c David Teigland 2007-04-26 1339 log_print("Can't create listening comms socket");
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1340 goto create_out;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1341 }
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1342
a5b7ab6352bfaa fs/dlm/lowcomms.c Alexander Aring 2020-06-26 1343 sock_set_mark(sock->sk, dlm_config.ci_mark);
a5b7ab6352bfaa fs/dlm/lowcomms.c Alexander Aring 2020-06-26 1344
cb2d45da81c86d fs/dlm/lowcomms.c David Teigland 2010-11-12 1345 /* Turn off Nagle's algorithm */
12abc5ee7873a0 fs/dlm/lowcomms.c Christoph Hellwig 2020-05-28 1346 tcp_sock_set_nodelay(sock->sk);
cb2d45da81c86d fs/dlm/lowcomms.c David Teigland 2010-11-12 1347
b58f0e8f38c0a4 fs/dlm/lowcomms.c Christoph Hellwig 2020-05-28 1348 sock_set_reuseaddr(sock->sk);
6ed7257b46709e fs/dlm/lowcomms.c Patrick Caulfield 2007-04-17 1349
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1350 add_listen_sock(sock, con);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1351
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1352 /* Bind to our port */
68c817a1c4e21b fs/dlm/lowcomms-tcp.c David Teigland 2007-01-09 1353 make_sockaddr(saddr, dlm_config.ci_tcp_port, &addr_len);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1354 result = sock->ops->bind(sock, (struct sockaddr *) saddr, addr_len);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1355 if (result < 0) {
617e82e10ccf96 fs/dlm/lowcomms.c David Teigland 2007-04-26 1356 log_print("Can't bind to port %d", dlm_config.ci_tcp_port);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1357 goto create_out;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1358 }
ce3d9544cecacd fs/dlm/lowcomms.c Christoph Hellwig 2020-05-28 @1359 sock_set_keepalive(sock->sk);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1360
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1361 result = sock->ops->listen(sock, 5);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1362 if (result < 0) {
617e82e10ccf96 fs/dlm/lowcomms.c David Teigland 2007-04-26 1363 log_print("Can't listen on port %d", dlm_config.ci_tcp_port);
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1364 goto create_out;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1365 }
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1366
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1367 return 0;
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1368
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1369 create_out:
d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1370 return result;
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1371 }
fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1372
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
The tcp_create_listen_sock() function was already dropped in commit <2dc6b1158c28c3a5e86d162628810312f98d5e97> by Alexander Aring. August 3, 2021 7:28 PM, "kernel test robot" <lkp@intel.com> wrote: > Hi Yajun, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on net-next/master] > > url: > https://github.com/0day-ci/linux/commits/Yajun-Deng/net-Modify-sock_set_keepalive-for-more-scenarios > 20210803-162757 > base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git > 7cdd0a89ec70ce6a720171f1f7817ee9502b134c > config: m68k-allmodconfig (attached as .config) > compiler: m68k-linux-gcc (GCC) 10.3.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/1dd4cca54718feb13bbafafb8104a414ddc49662 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review > Yajun-Deng/net-Modify-sock_set_keepalive-for-more-scenarios/20210803-162757 > git checkout 1dd4cca54718feb13bbafafb8104a414ddc49662 > # save the attached .config to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=m68k > SHELL=/bin/bash fs/dlm/ > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All errors (new ones prefixed by >>): > > fs/dlm/lowcomms.c: In function 'tcp_create_listen_sock': > >>> fs/dlm/lowcomms.c:1359:2: error: too few arguments to function 'sock_set_keepalive' > > 1359 | sock_set_keepalive(sock->sk); > | ^~~~~~~~~~~~~~~~~~ > In file included from fs/dlm/lowcomms.c:46: > include/net/sock.h:2775:6: note: declared here > 2775 | void sock_set_keepalive(struct sock *sk, bool valbool); > | ^~~~~~~~~~~~~~~~~~ > > vim +/sock_set_keepalive +1359 fs/dlm/lowcomms.c > > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1319 > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1320 /* On error caller must run > dlm_close_sock() for the > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1321 * listen connection socket. > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1322 */ > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1323 static int > tcp_create_listen_sock(struct listen_connection *con, > ac33d071059557 fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-12-06 1324 struct sockaddr_storage > *saddr) > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1325 { > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1326 struct socket *sock = NULL; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1327 int result = 0; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1328 int addr_len; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1329 > 6ed7257b46709e fs/dlm/lowcomms.c Patrick Caulfield 2007-04-17 1330 if (dlm_local_addr[0]->ss_family > == AF_INET) > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1331 addr_len = sizeof(struct > sockaddr_in); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1332 else > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1333 addr_len = sizeof(struct > sockaddr_in6); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1334 > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1335 /* Create a socket to > communicate with */ > eeb1bd5c40edb0 fs/dlm/lowcomms.c Eric W. Biederman 2015-05-08 1336 result = > sock_create_kern(&init_net, dlm_local_addr[0]->ss_family, > eeb1bd5c40edb0 fs/dlm/lowcomms.c Eric W. Biederman 2015-05-08 1337 SOCK_STREAM, IPPROTO_TCP, > &sock); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1338 if (result < 0) { > 617e82e10ccf96 fs/dlm/lowcomms.c David Teigland 2007-04-26 1339 log_print("Can't create listening > comms socket"); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1340 goto create_out; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1341 } > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1342 > a5b7ab6352bfaa fs/dlm/lowcomms.c Alexander Aring 2020-06-26 1343 sock_set_mark(sock->sk, > dlm_config.ci_mark); > a5b7ab6352bfaa fs/dlm/lowcomms.c Alexander Aring 2020-06-26 1344 > cb2d45da81c86d fs/dlm/lowcomms.c David Teigland 2010-11-12 1345 /* Turn off Nagle's algorithm */ > 12abc5ee7873a0 fs/dlm/lowcomms.c Christoph Hellwig 2020-05-28 1346 tcp_sock_set_nodelay(sock->sk); > cb2d45da81c86d fs/dlm/lowcomms.c David Teigland 2010-11-12 1347 > b58f0e8f38c0a4 fs/dlm/lowcomms.c Christoph Hellwig 2020-05-28 1348 sock_set_reuseaddr(sock->sk); > 6ed7257b46709e fs/dlm/lowcomms.c Patrick Caulfield 2007-04-17 1349 > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1350 add_listen_sock(sock, con); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1351 > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1352 /* Bind to our port */ > 68c817a1c4e21b fs/dlm/lowcomms-tcp.c David Teigland 2007-01-09 1353 make_sockaddr(saddr, > dlm_config.ci_tcp_port, &addr_len); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1354 result = > sock->ops->bind(sock, (struct sockaddr *) saddr, addr_len); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1355 if (result < 0) { > 617e82e10ccf96 fs/dlm/lowcomms.c David Teigland 2007-04-26 1356 log_print("Can't bind to port %d", > dlm_config.ci_tcp_port); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1357 goto create_out; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1358 } > ce3d9544cecacd fs/dlm/lowcomms.c Christoph Hellwig 2020-05-28 @1359 sock_set_keepalive(sock->sk); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1360 > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1361 result = > sock->ops->listen(sock, 5); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1362 if (result < 0) { > 617e82e10ccf96 fs/dlm/lowcomms.c David Teigland 2007-04-26 1363 log_print("Can't listen on port > %d", dlm_config.ci_tcp_port); > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1364 goto create_out; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1365 } > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1366 > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1367 return 0; > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1368 > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1369 create_out: > d11ccd451b6556 fs/dlm/lowcomms.c Alexander Aring 2020-11-02 1370 return result; > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1371 } > fdda387f73947e fs/dlm/lowcomms-tcp.c Patrick Caulfield 2006-11-02 1372 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Tue, 03 Aug 2021 11:42:39 +0000 yajun.deng@linux.dev wrote: > The tcp_create_listen_sock() function was already dropped in commit > <2dc6b1158c28c3a5e86d162628810312f98d5e97> by Alexander Aring. We don't have the commit you're quoting in the networking trees. You should modify tcp_create_listen_sock() and we'll deal with the conflict during the merge window. Unless obviously you should wait and "send the patch within a context of other scenarios".. (I'm unclear on what Denis is referring to.)
diff --git a/include/net/sock.h b/include/net/sock.h index ff1be7e7e90b..0aae26159549 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2772,7 +2772,7 @@ int sock_set_timestamping(struct sock *sk, int optname, void sock_enable_timestamps(struct sock *sk); void sock_no_linger(struct sock *sk); -void sock_set_keepalive(struct sock *sk); +void sock_set_keepalive(struct sock *sk, bool valbool); void sock_set_priority(struct sock *sk, u32 priority); void sock_set_rcvbuf(struct sock *sk, int val); void sock_set_mark(struct sock *sk, u32 val); diff --git a/net/core/filter.c b/net/core/filter.c index faf29fd82276..41b2bf140b89 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4769,9 +4769,7 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname, ret = sock_bindtoindex(sk, ifindex, false); break; case SO_KEEPALIVE: - if (sk->sk_prot->keepalive) - sk->sk_prot->keepalive(sk, valbool); - sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); + sock_set_keepalive(sk, !!valbool); break; case SO_REUSEPORT: sk->sk_reuseport = valbool; diff --git a/net/core/sock.c b/net/core/sock.c index 9671c32e6ef5..7041e6355ae1 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -892,12 +892,12 @@ int sock_set_timestamping(struct sock *sk, int optname, return 0; } -void sock_set_keepalive(struct sock *sk) +void sock_set_keepalive(struct sock *sk, bool valbool) { lock_sock(sk); if (sk->sk_prot->keepalive) - sk->sk_prot->keepalive(sk, true); - sock_valbool_flag(sk, SOCK_KEEPOPEN, true); + sk->sk_prot->keepalive(sk, valbool); + sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); release_sock(sk); } EXPORT_SYMBOL(sock_set_keepalive); @@ -1060,9 +1060,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, break; case SO_KEEPALIVE: - if (sk->sk_prot->keepalive) - sk->sk_prot->keepalive(sk, valbool); - sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); + sock_set_keepalive(sk, !!valbool); break; case SO_OOBINLINE: diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 8c03afac5ca0..879b8381055c 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -81,9 +81,7 @@ static void mptcp_sol_socket_sync_intval(struct mptcp_sock *msk, int optname, in sock_valbool_flag(ssk, SOCK_DBG, !!val); break; case SO_KEEPALIVE: - if (ssk->sk_prot->keepalive) - ssk->sk_prot->keepalive(ssk, !!val); - sock_valbool_flag(ssk, SOCK_KEEPOPEN, !!val); + sock_set_keepalive(ssk, !!val); break; case SO_PRIORITY: ssk->sk_priority = val; diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 09cadd556d1e..b69ebb3f424a 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -44,7 +44,7 @@ void rds_tcp_keepalive(struct socket *sock) int keepidle = 5; /* send a probe 'keepidle' secs after last data */ int keepcnt = 5; /* number of unack'ed probes before declaring dead */ - sock_set_keepalive(sock->sk); + sock_set_keepalive(sock->sk, true); tcp_sock_set_keepcnt(sock->sk, keepcnt); tcp_sock_set_keepidle(sock->sk, keepidle); /* KEEPINTVL is the interval between successive probes. We follow diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 898389611ae8..ad8f4302037f 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -68,7 +68,7 @@ static void smc_set_keepalive(struct sock *sk, int val) { struct smc_sock *smc = smc_sk(sk); - smc->clcsock->sk->sk_prot->keepalive(smc->clcsock->sk, val); + sock_set_keepalive(smc->clcsock->sk, !!val); } static struct smc_hashinfo smc_v4_hashinfo = { diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index e573dcecdd66..306a332f8d28 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2127,7 +2127,7 @@ static void xs_tcp_set_socket_timeouts(struct rpc_xprt *xprt, spin_unlock(&xprt->transport_lock); /* TCP Keepalive options */ - sock_set_keepalive(sock->sk); + sock_set_keepalive(sock->sk, true); tcp_sock_set_keepidle(sock->sk, keepidle); tcp_sock_set_keepintvl(sock->sk, keepidle); tcp_sock_set_keepcnt(sock->sk, keepcnt);
Add 2nd parameter in sock_set_keepalive(), let the caller decide whether to set. This can be applied to more scenarios. Signed-off-by: Yajun Deng <yajun.deng@linux.dev> --- include/net/sock.h | 2 +- net/core/filter.c | 4 +--- net/core/sock.c | 10 ++++------ net/mptcp/sockopt.c | 4 +--- net/rds/tcp_listen.c | 2 +- net/smc/af_smc.c | 2 +- net/sunrpc/xprtsock.c | 2 +- 7 files changed, 10 insertions(+), 16 deletions(-)