File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1517,9 +1517,12 @@ static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1517
1517
static inline int keepalive_time_when (const struct tcp_sock * tp )
1518
1518
{
1519
1519
struct net * net = sock_net ((struct sock * )tp );
1520
+ int val ;
1520
1521
1521
- return tp -> keepalive_time ? :
1522
- READ_ONCE (net -> ipv4 .sysctl_tcp_keepalive_time );
1522
+ /* Paired with WRITE_ONCE() in tcp_sock_set_keepidle_locked() */
1523
+ val = READ_ONCE (tp -> keepalive_time );
1524
+
1525
+ return val ? : READ_ONCE (net -> ipv4 .sysctl_tcp_keepalive_time );
1523
1526
}
1524
1527
1525
1528
static inline int keepalive_probes (const struct tcp_sock * tp )
Original file line number Diff line number Diff line change @@ -3312,7 +3312,8 @@ int tcp_sock_set_keepidle_locked(struct sock *sk, int val)
3312
3312
if (val < 1 || val > MAX_TCP_KEEPIDLE )
3313
3313
return - EINVAL ;
3314
3314
3315
- tp -> keepalive_time = val * HZ ;
3315
+ /* Paired with WRITE_ONCE() in keepalive_time_when() */
3316
+ WRITE_ONCE (tp -> keepalive_time , val * HZ );
3316
3317
if (sock_flag (sk , SOCK_KEEPOPEN ) &&
3317
3318
!((1 << sk -> sk_state ) & (TCPF_CLOSE | TCPF_LISTEN ))) {
3318
3319
u32 elapsed = keepalive_time_elapsed (tp );
You can’t perform that action at this time.
0 commit comments