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.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) The real fix for the ipv6 route metric leak Sabrina was seeing, from
Cong Wang.

2) Fix syzbot triggers AF_PACKET v3 ring buffer insufficient room
conditions, from Willem de Bruijn.

3) vsock can reinitialize active work struct, fix from Cong Wang.

4) RXRPC keepalive generator can wedge a cpu, fix from David Howells.

5) Fix locking in AF_SMC ioctl, from Ursula Braun.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
dsa: slave: eee: Allow ports to use phylink
net/smc: move sock lock in smc_ioctl()
net/smc: allow sysctl rmem and wmem defaults for servers
net/smc: no shutdown in state SMC_LISTEN
net: aquantia: Fix IFF_ALLMULTI flag functionality
rxrpc: Fix the keepalive generator [ver #2]
net/mlx5e: Cleanup of dcbnl related fields
net/mlx5e: Properly check if hairpin is possible between two functions
vhost: reset metadata cache when initializing new IOTLB
llc: use refcount_inc_not_zero() for llc_sap_find()
dccp: fix undefined behavior with 'cwnd' shift in ccid2_cwnd_restart()
tipc: fix an interrupt unsafe locking scenario
vsock: split dwork to avoid reinitializations
net: thunderx: check for failed allocation lmac->dmacs
cxgb4: mk_act_open_req() buggers ->{local, peer}_ip on big-endian hosts
packet: refine ring v3 block size test to hold one frame
ip6_tunnel: use the right value for ipv4 min mtu check in ip6_tnl_xmit
ipv6: fix double refcount of fib6_metrics

+185 -168
+1 -1
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 762 762 763 763 hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC)); 764 764 hw_atl_rpfl2multicast_flr_en_set(self, 765 - IS_FILTER_ENABLED(IFF_MULTICAST), 0); 765 + IS_FILTER_ENABLED(IFF_ALLMULTI), 0); 766 766 767 767 hw_atl_rpfl2_accept_all_mc_packets_set(self, 768 768 IS_FILTER_ENABLED(IFF_ALLMULTI));
+2
drivers/net/ethernet/cavium/thunder/thunder_bgx.c
··· 1083 1083 lmac->dmacs_count = (RX_DMAC_COUNT / bgx->lmac_count); 1084 1084 lmac->dmacs = kcalloc(lmac->dmacs_count, sizeof(*lmac->dmacs), 1085 1085 GFP_KERNEL); 1086 + if (!lmac->dmacs) 1087 + return -ENOMEM; 1086 1088 1087 1089 /* Enable lmac */ 1088 1090 bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN);
+2 -4
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
··· 1038 1038 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, qid_filterid)); 1039 1039 req->local_port = cpu_to_be16(f->fs.val.lport); 1040 1040 req->peer_port = cpu_to_be16(f->fs.val.fport); 1041 - req->local_ip = f->fs.val.lip[0] | f->fs.val.lip[1] << 8 | 1042 - f->fs.val.lip[2] << 16 | f->fs.val.lip[3] << 24; 1043 - req->peer_ip = f->fs.val.fip[0] | f->fs.val.fip[1] << 8 | 1044 - f->fs.val.fip[2] << 16 | f->fs.val.fip[3] << 24; 1041 + memcpy(&req->local_ip, f->fs.val.lip, 4); 1042 + memcpy(&req->peer_ip, f->fs.val.fip, 4); 1045 1043 req->opt0 = cpu_to_be64(NAGLE_V(f->fs.newvlan == VLAN_REMOVE || 1046 1044 f->fs.newvlan == VLAN_REWRITE) | 1047 1045 DELACK_V(f->fs.hitcnts) |
-2
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 858 858 mlx5e_fp_handle_rx_cqe handle_rx_cqe; 859 859 mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe; 860 860 } rx_handlers; 861 - void (*netdev_registered_init)(struct mlx5e_priv *priv); 862 - void (*netdev_registered_remove)(struct mlx5e_priv *priv); 863 861 int max_tc; 864 862 }; 865 863
+11 -19
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
··· 443 443 bool is_new; 444 444 int err; 445 445 446 - if (app->selector != IEEE_8021QAZ_APP_SEL_DSCP) 447 - return -EINVAL; 446 + if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager) || 447 + !MLX5_DSCP_SUPPORTED(priv->mdev)) 448 + return -EOPNOTSUPP; 448 449 449 - if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager)) 450 - return -EINVAL; 451 - 452 - if (!MLX5_DSCP_SUPPORTED(priv->mdev)) 453 - return -EINVAL; 454 - 455 - if (app->protocol >= MLX5E_MAX_DSCP) 450 + if ((app->selector != IEEE_8021QAZ_APP_SEL_DSCP) || 451 + (app->protocol >= MLX5E_MAX_DSCP)) 456 452 return -EINVAL; 457 453 458 454 /* Save the old entry info */ ··· 496 500 struct mlx5e_priv *priv = netdev_priv(dev); 497 501 int err; 498 502 499 - if (app->selector != IEEE_8021QAZ_APP_SEL_DSCP) 500 - return -EINVAL; 503 + if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager) || 504 + !MLX5_DSCP_SUPPORTED(priv->mdev)) 505 + return -EOPNOTSUPP; 501 506 502 - if (!MLX5_CAP_GEN(priv->mdev, vport_group_manager)) 503 - return -EINVAL; 504 - 505 - if (!MLX5_DSCP_SUPPORTED(priv->mdev)) 506 - return -EINVAL; 507 - 508 - if (app->protocol >= MLX5E_MAX_DSCP) 507 + if ((app->selector != IEEE_8021QAZ_APP_SEL_DSCP) || 508 + (app->protocol >= MLX5E_MAX_DSCP)) 509 509 return -EINVAL; 510 510 511 511 /* Skip if no dscp app entry */ ··· 1138 1146 { 1139 1147 int err; 1140 1148 1141 - err = mlx5_set_trust_state(priv->mdev, trust_state); 1149 + err = mlx5_set_trust_state(priv->mdev, trust_state); 1142 1150 if (err) 1143 1151 return err; 1144 1152 priv->dcbx_dp.trust_state = trust_state;
+4 -4
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1970 1970 static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv) 1971 1971 { 1972 1972 struct mlx5_core_dev *fmdev, *pmdev; 1973 - u16 func_id, peer_id; 1973 + u64 fsystem_guid, psystem_guid; 1974 1974 1975 1975 fmdev = priv->mdev; 1976 1976 pmdev = peer_priv->mdev; 1977 1977 1978 - func_id = (u16)((fmdev->pdev->bus->number << 8) | PCI_SLOT(fmdev->pdev->devfn)); 1979 - peer_id = (u16)((pmdev->pdev->bus->number << 8) | PCI_SLOT(pmdev->pdev->devfn)); 1978 + mlx5_query_nic_vport_system_image_guid(fmdev, &fsystem_guid); 1979 + mlx5_query_nic_vport_system_image_guid(pmdev, &psystem_guid); 1980 1980 1981 - return (func_id == peer_id); 1981 + return (fsystem_guid == psystem_guid); 1982 1982 } 1983 1983 1984 1984 static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
+6 -3
drivers/vhost/vhost.c
··· 1560 1560 d->iotlb = niotlb; 1561 1561 1562 1562 for (i = 0; i < d->nvqs; ++i) { 1563 - mutex_lock(&d->vqs[i]->mutex); 1564 - d->vqs[i]->iotlb = niotlb; 1565 - mutex_unlock(&d->vqs[i]->mutex); 1563 + struct vhost_virtqueue *vq = d->vqs[i]; 1564 + 1565 + mutex_lock(&vq->mutex); 1566 + vq->iotlb = niotlb; 1567 + __vhost_vq_meta_reset(vq); 1568 + mutex_unlock(&vq->mutex); 1566 1569 } 1567 1570 1568 1571 vhost_umem_clean(oiotlb);
+2 -2
include/net/af_vsock.h
··· 64 64 struct list_head pending_links; 65 65 struct list_head accept_queue; 66 66 bool rejected; 67 - struct delayed_work dwork; 67 + struct delayed_work connect_work; 68 + struct delayed_work pending_work; 68 69 struct delayed_work close_work; 69 70 bool close_work_scheduled; 70 71 u32 peer_shutdown; ··· 78 77 79 78 s64 vsock_stream_has_data(struct vsock_sock *vsk); 80 79 s64 vsock_stream_has_space(struct vsock_sock *vsk); 81 - void vsock_pending_work(struct work_struct *work); 82 80 struct sock *__vsock_create(struct net *net, 83 81 struct socket *sock, 84 82 struct sock *parent,
+5
include/net/llc.h
··· 116 116 refcount_inc(&sap->refcnt); 117 117 } 118 118 119 + static inline bool llc_sap_hold_safe(struct llc_sap *sap) 120 + { 121 + return refcount_inc_not_zero(&sap->refcnt); 122 + } 123 + 119 124 void llc_sap_close(struct llc_sap *sap); 120 125 121 126 static inline void llc_sap_put(struct llc_sap *sap)
+4 -2
net/dccp/ccids/ccid2.c
··· 229 229 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); 230 230 u32 cwnd = hc->tx_cwnd, restart_cwnd, 231 231 iwnd = rfc3390_bytes_to_packets(dccp_sk(sk)->dccps_mss_cache); 232 + s32 delta = now - hc->tx_lsndtime; 232 233 233 234 hc->tx_ssthresh = max(hc->tx_ssthresh, (cwnd >> 1) + (cwnd >> 2)); 234 235 235 236 /* don't reduce cwnd below the initial window (IW) */ 236 237 restart_cwnd = min(cwnd, iwnd); 237 - cwnd >>= (now - hc->tx_lsndtime) / hc->tx_rto; 238 - hc->tx_cwnd = max(cwnd, restart_cwnd); 239 238 239 + while ((delta -= hc->tx_rto) >= 0 && cwnd > restart_cwnd) 240 + cwnd >>= 1; 241 + hc->tx_cwnd = max(cwnd, restart_cwnd); 240 242 hc->tx_cwnd_stamp = now; 241 243 hc->tx_cwnd_used = 0; 242 244
+2 -2
net/dsa/slave.c
··· 639 639 int ret; 640 640 641 641 /* Port's PHY and MAC both need to be EEE capable */ 642 - if (!dev->phydev) 642 + if (!dev->phydev && !dp->pl) 643 643 return -ENODEV; 644 644 645 645 if (!ds->ops->set_mac_eee) ··· 659 659 int ret; 660 660 661 661 /* Port's PHY and MAC both need to be EEE capable */ 662 - if (!dev->phydev) 662 + if (!dev->phydev && !dp->pl) 663 663 return -ENODEV; 664 664 665 665 if (!ds->ops->get_mac_eee)
+2 -6
net/ipv6/ip6_tunnel.c
··· 1133 1133 max_headroom += 8; 1134 1134 mtu -= 8; 1135 1135 } 1136 - if (skb->protocol == htons(ETH_P_IPV6)) { 1137 - if (mtu < IPV6_MIN_MTU) 1138 - mtu = IPV6_MIN_MTU; 1139 - } else if (mtu < 576) { 1140 - mtu = 576; 1141 - } 1136 + mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ? 1137 + IPV6_MIN_MTU : IPV4_MIN_MTU); 1142 1138 1143 1139 skb_dst_update_pmtu(skb, mtu); 1144 1140 if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) {
-4
net/ipv6/route.c
··· 978 978 rt->rt6i_flags &= ~RTF_EXPIRES; 979 979 rcu_assign_pointer(rt->from, from); 980 980 dst_init_metrics(&rt->dst, from->fib6_metrics->metrics, true); 981 - if (from->fib6_metrics != &dst_default_metrics) { 982 - rt->dst._metrics |= DST_METRICS_REFCOUNTED; 983 - refcount_inc(&from->fib6_metrics->refcnt); 984 - } 985 981 } 986 982 987 983 /* Caller must already hold reference to @ort */
+2 -2
net/llc/llc_core.c
··· 73 73 74 74 rcu_read_lock_bh(); 75 75 sap = __llc_sap_find(sap_value); 76 - if (sap) 77 - llc_sap_hold(sap); 76 + if (!sap || !llc_sap_hold_safe(sap)) 77 + sap = NULL; 78 78 rcu_read_unlock_bh(); 79 79 return sap; 80 80 }
+6 -4
net/packet/af_packet.c
··· 4226 4226 } 4227 4227 4228 4228 if (req->tp_block_nr) { 4229 + unsigned int min_frame_size; 4230 + 4229 4231 /* Sanity tests and some calculations */ 4230 4232 err = -EBUSY; 4231 4233 if (unlikely(rb->pg_vec)) ··· 4250 4248 goto out; 4251 4249 if (unlikely(!PAGE_ALIGNED(req->tp_block_size))) 4252 4250 goto out; 4251 + min_frame_size = po->tp_hdrlen + po->tp_reserve; 4253 4252 if (po->tp_version >= TPACKET_V3 && 4254 - req->tp_block_size <= 4255 - BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv) + sizeof(struct tpacket3_hdr)) 4253 + req->tp_block_size < 4254 + BLK_PLUS_PRIV((u64)req_u->req3.tp_sizeof_priv) + min_frame_size) 4256 4255 goto out; 4257 - if (unlikely(req->tp_frame_size < po->tp_hdrlen + 4258 - po->tp_reserve)) 4256 + if (unlikely(req->tp_frame_size < min_frame_size)) 4259 4257 goto out; 4260 4258 if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1))) 4261 4259 goto out;
+4 -4
net/rxrpc/ar-internal.h
··· 104 104 105 105 #define RXRPC_KEEPALIVE_TIME 20 /* NAT keepalive time in seconds */ 106 106 u8 peer_keepalive_cursor; 107 - ktime_t peer_keepalive_base; 108 - struct hlist_head peer_keepalive[RXRPC_KEEPALIVE_TIME + 1]; 109 - struct hlist_head peer_keepalive_new; 107 + time64_t peer_keepalive_base; 108 + struct list_head peer_keepalive[32]; 109 + struct list_head peer_keepalive_new; 110 110 struct timer_list peer_keepalive_timer; 111 111 struct work_struct peer_keepalive_work; 112 112 }; ··· 295 295 struct hlist_head error_targets; /* targets for net error distribution */ 296 296 struct work_struct error_distributor; 297 297 struct rb_root service_conns; /* Service connections */ 298 - struct hlist_node keepalive_link; /* Link in net->peer_keepalive[] */ 298 + struct list_head keepalive_link; /* Link in net->peer_keepalive[] */ 299 299 time64_t last_tx_at; /* Last time packet sent here */ 300 300 seqlock_t service_conn_lock; 301 301 spinlock_t lock; /* access lock */
+2 -2
net/rxrpc/conn_event.c
··· 136 136 } 137 137 138 138 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); 139 - conn->params.peer->last_tx_at = ktime_get_real(); 139 + conn->params.peer->last_tx_at = ktime_get_seconds(); 140 140 if (ret < 0) 141 141 trace_rxrpc_tx_fail(conn->debug_id, serial, ret, 142 142 rxrpc_tx_fail_call_final_resend); ··· 245 245 return -EAGAIN; 246 246 } 247 247 248 - conn->params.peer->last_tx_at = ktime_get_real(); 248 + conn->params.peer->last_tx_at = ktime_get_seconds(); 249 249 250 250 _leave(" = 0"); 251 251 return 0;
+3 -3
net/rxrpc/net_ns.c
··· 85 85 hash_init(rxnet->peer_hash); 86 86 spin_lock_init(&rxnet->peer_hash_lock); 87 87 for (i = 0; i < ARRAY_SIZE(rxnet->peer_keepalive); i++) 88 - INIT_HLIST_HEAD(&rxnet->peer_keepalive[i]); 89 - INIT_HLIST_HEAD(&rxnet->peer_keepalive_new); 88 + INIT_LIST_HEAD(&rxnet->peer_keepalive[i]); 89 + INIT_LIST_HEAD(&rxnet->peer_keepalive_new); 90 90 timer_setup(&rxnet->peer_keepalive_timer, 91 91 rxrpc_peer_keepalive_timeout, 0); 92 92 INIT_WORK(&rxnet->peer_keepalive_work, rxrpc_peer_keepalive_worker); 93 - rxnet->peer_keepalive_base = ktime_add(ktime_get_real(), NSEC_PER_SEC); 93 + rxnet->peer_keepalive_base = ktime_get_seconds(); 94 94 95 95 ret = -ENOMEM; 96 96 rxnet->proc_net = proc_net_mkdir(net, "rxrpc", net->proc_net);
+6 -6
net/rxrpc/output.c
··· 209 209 now = ktime_get_real(); 210 210 if (ping) 211 211 call->ping_time = now; 212 - conn->params.peer->last_tx_at = ktime_get_real(); 212 + conn->params.peer->last_tx_at = ktime_get_seconds(); 213 213 if (ret < 0) 214 214 trace_rxrpc_tx_fail(call->debug_id, serial, ret, 215 215 rxrpc_tx_fail_call_ack); ··· 296 296 297 297 ret = kernel_sendmsg(conn->params.local->socket, 298 298 &msg, iov, 1, sizeof(pkt)); 299 - conn->params.peer->last_tx_at = ktime_get_real(); 299 + conn->params.peer->last_tx_at = ktime_get_seconds(); 300 300 if (ret < 0) 301 301 trace_rxrpc_tx_fail(call->debug_id, serial, ret, 302 302 rxrpc_tx_fail_call_abort); ··· 391 391 * message and update the peer record 392 392 */ 393 393 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); 394 - conn->params.peer->last_tx_at = ktime_get_real(); 394 + conn->params.peer->last_tx_at = ktime_get_seconds(); 395 395 396 396 up_read(&conn->params.local->defrag_sem); 397 397 if (ret < 0) ··· 457 457 if (ret == 0) { 458 458 ret = kernel_sendmsg(conn->params.local->socket, &msg, 459 459 iov, 2, len); 460 - conn->params.peer->last_tx_at = ktime_get_real(); 460 + conn->params.peer->last_tx_at = ktime_get_seconds(); 461 461 462 462 opt = IP_PMTUDISC_DO; 463 463 kernel_setsockopt(conn->params.local->socket, SOL_IP, ··· 475 475 if (ret == 0) { 476 476 ret = kernel_sendmsg(conn->params.local->socket, &msg, 477 477 iov, 2, len); 478 - conn->params.peer->last_tx_at = ktime_get_real(); 478 + conn->params.peer->last_tx_at = ktime_get_seconds(); 479 479 480 480 opt = IPV6_PMTUDISC_DO; 481 481 kernel_setsockopt(conn->params.local->socket, ··· 599 599 trace_rxrpc_tx_fail(peer->debug_id, 0, ret, 600 600 rxrpc_tx_fail_version_keepalive); 601 601 602 - peer->last_tx_at = ktime_get_real(); 602 + peer->last_tx_at = ktime_get_seconds(); 603 603 _leave(""); 604 604 }
+93 -73
net/rxrpc/peer_event.c
··· 350 350 } 351 351 352 352 /* 353 + * Perform keep-alive pings. 354 + */ 355 + static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet, 356 + struct list_head *collector, 357 + time64_t base, 358 + u8 cursor) 359 + { 360 + struct rxrpc_peer *peer; 361 + const u8 mask = ARRAY_SIZE(rxnet->peer_keepalive) - 1; 362 + time64_t keepalive_at; 363 + int slot; 364 + 365 + spin_lock_bh(&rxnet->peer_hash_lock); 366 + 367 + while (!list_empty(collector)) { 368 + peer = list_entry(collector->next, 369 + struct rxrpc_peer, keepalive_link); 370 + 371 + list_del_init(&peer->keepalive_link); 372 + if (!rxrpc_get_peer_maybe(peer)) 373 + continue; 374 + 375 + spin_unlock_bh(&rxnet->peer_hash_lock); 376 + 377 + keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME; 378 + slot = keepalive_at - base; 379 + _debug("%02x peer %u t=%d {%pISp}", 380 + cursor, peer->debug_id, slot, &peer->srx.transport); 381 + 382 + if (keepalive_at <= base || 383 + keepalive_at > base + RXRPC_KEEPALIVE_TIME) { 384 + rxrpc_send_keepalive(peer); 385 + slot = RXRPC_KEEPALIVE_TIME; 386 + } 387 + 388 + /* A transmission to this peer occurred since last we examined 389 + * it so put it into the appropriate future bucket. 390 + */ 391 + slot += cursor; 392 + slot &= mask; 393 + spin_lock_bh(&rxnet->peer_hash_lock); 394 + list_add_tail(&peer->keepalive_link, 395 + &rxnet->peer_keepalive[slot & mask]); 396 + rxrpc_put_peer(peer); 397 + } 398 + 399 + spin_unlock_bh(&rxnet->peer_hash_lock); 400 + } 401 + 402 + /* 353 403 * Perform keep-alive pings with VERSION packets to keep any NAT alive. 354 404 */ 355 405 void rxrpc_peer_keepalive_worker(struct work_struct *work) 356 406 { 357 407 struct rxrpc_net *rxnet = 358 408 container_of(work, struct rxrpc_net, peer_keepalive_work); 359 - struct rxrpc_peer *peer; 360 - unsigned long delay; 361 - ktime_t base, now = ktime_get_real(); 362 - s64 diff; 363 - u8 cursor, slot; 409 + const u8 mask = ARRAY_SIZE(rxnet->peer_keepalive) - 1; 410 + time64_t base, now, delay; 411 + u8 cursor, stop; 412 + LIST_HEAD(collector); 364 413 414 + now = ktime_get_seconds(); 365 415 base = rxnet->peer_keepalive_base; 366 416 cursor = rxnet->peer_keepalive_cursor; 417 + _enter("%lld,%u", base - now, cursor); 367 418 368 - _enter("%u,%lld", cursor, ktime_sub(now, base)); 419 + if (!rxnet->live) 420 + return; 369 421 370 - next_bucket: 371 - diff = ktime_to_ns(ktime_sub(now, base)); 372 - if (diff < 0) 373 - goto resched; 374 - 375 - _debug("at %u", cursor); 376 - spin_lock_bh(&rxnet->peer_hash_lock); 377 - next_peer: 378 - if (!rxnet->live) { 379 - spin_unlock_bh(&rxnet->peer_hash_lock); 380 - goto out; 381 - } 382 - 383 - /* Everything in the bucket at the cursor is processed this second; the 384 - * bucket at cursor + 1 goes now + 1s and so on... 422 + /* Remove to a temporary list all the peers that are currently lodged 423 + * in expired buckets plus all new peers. 424 + * 425 + * Everything in the bucket at the cursor is processed this 426 + * second; the bucket at cursor + 1 goes at now + 1s and so 427 + * on... 385 428 */ 386 - if (hlist_empty(&rxnet->peer_keepalive[cursor])) { 387 - if (hlist_empty(&rxnet->peer_keepalive_new)) { 388 - spin_unlock_bh(&rxnet->peer_hash_lock); 389 - goto emptied_bucket; 390 - } 429 + spin_lock_bh(&rxnet->peer_hash_lock); 430 + list_splice_init(&rxnet->peer_keepalive_new, &collector); 391 431 392 - hlist_move_list(&rxnet->peer_keepalive_new, 393 - &rxnet->peer_keepalive[cursor]); 432 + stop = cursor + ARRAY_SIZE(rxnet->peer_keepalive); 433 + while (base <= now && (s8)(cursor - stop) < 0) { 434 + list_splice_tail_init(&rxnet->peer_keepalive[cursor & mask], 435 + &collector); 436 + base++; 437 + cursor++; 394 438 } 395 439 396 - peer = hlist_entry(rxnet->peer_keepalive[cursor].first, 397 - struct rxrpc_peer, keepalive_link); 398 - hlist_del_init(&peer->keepalive_link); 399 - if (!rxrpc_get_peer_maybe(peer)) 400 - goto next_peer; 401 - 440 + base = now; 402 441 spin_unlock_bh(&rxnet->peer_hash_lock); 403 442 404 - _debug("peer %u {%pISp}", peer->debug_id, &peer->srx.transport); 405 - 406 - recalc: 407 - diff = ktime_divns(ktime_sub(peer->last_tx_at, base), NSEC_PER_SEC); 408 - if (diff < -30 || diff > 30) 409 - goto send; /* LSW of 64-bit time probably wrapped on 32-bit */ 410 - diff += RXRPC_KEEPALIVE_TIME - 1; 411 - if (diff < 0) 412 - goto send; 413 - 414 - slot = (diff > RXRPC_KEEPALIVE_TIME - 1) ? RXRPC_KEEPALIVE_TIME - 1 : diff; 415 - if (slot == 0) 416 - goto send; 417 - 418 - /* A transmission to this peer occurred since last we examined it so 419 - * put it into the appropriate future bucket. 420 - */ 421 - slot = (slot + cursor) % ARRAY_SIZE(rxnet->peer_keepalive); 422 - spin_lock_bh(&rxnet->peer_hash_lock); 423 - hlist_add_head(&peer->keepalive_link, &rxnet->peer_keepalive[slot]); 424 - rxrpc_put_peer(peer); 425 - goto next_peer; 426 - 427 - send: 428 - rxrpc_send_keepalive(peer); 429 - now = ktime_get_real(); 430 - goto recalc; 431 - 432 - emptied_bucket: 433 - cursor++; 434 - if (cursor >= ARRAY_SIZE(rxnet->peer_keepalive)) 435 - cursor = 0; 436 - base = ktime_add_ns(base, NSEC_PER_SEC); 437 - goto next_bucket; 438 - 439 - resched: 440 443 rxnet->peer_keepalive_base = base; 441 444 rxnet->peer_keepalive_cursor = cursor; 442 - delay = nsecs_to_jiffies(-diff) + 1; 443 - timer_reduce(&rxnet->peer_keepalive_timer, jiffies + delay); 444 - out: 445 + rxrpc_peer_keepalive_dispatch(rxnet, &collector, base, cursor); 446 + ASSERT(list_empty(&collector)); 447 + 448 + /* Schedule the timer for the next occupied timeslot. */ 449 + cursor = rxnet->peer_keepalive_cursor; 450 + stop = cursor + RXRPC_KEEPALIVE_TIME - 1; 451 + for (; (s8)(cursor - stop) < 0; cursor++) { 452 + if (!list_empty(&rxnet->peer_keepalive[cursor & mask])) 453 + break; 454 + base++; 455 + } 456 + 457 + now = ktime_get_seconds(); 458 + delay = base - now; 459 + if (delay < 1) 460 + delay = 1; 461 + delay *= HZ; 462 + if (rxnet->live) 463 + timer_reduce(&rxnet->peer_keepalive_timer, jiffies + delay); 464 + 445 465 _leave(""); 446 466 }
+4 -4
net/rxrpc/peer_object.c
··· 322 322 if (!peer) { 323 323 peer = prealloc; 324 324 hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); 325 - hlist_add_head(&peer->keepalive_link, &rxnet->peer_keepalive_new); 325 + list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new); 326 326 } 327 327 328 328 spin_unlock(&rxnet->peer_hash_lock); ··· 367 367 if (!peer) { 368 368 hash_add_rcu(rxnet->peer_hash, 369 369 &candidate->hash_link, hash_key); 370 - hlist_add_head(&candidate->keepalive_link, 371 - &rxnet->peer_keepalive_new); 370 + list_add_tail(&candidate->keepalive_link, 371 + &rxnet->peer_keepalive_new); 372 372 } 373 373 374 374 spin_unlock_bh(&rxnet->peer_hash_lock); ··· 441 441 442 442 spin_lock_bh(&rxnet->peer_hash_lock); 443 443 hash_del_rcu(&peer->hash_link); 444 - hlist_del_init(&peer->keepalive_link); 444 + list_del_init(&peer->keepalive_link); 445 445 spin_unlock_bh(&rxnet->peer_hash_lock); 446 446 447 447 kfree_rcu(peer, rcu);
+2 -2
net/rxrpc/rxkad.c
··· 669 669 return -EAGAIN; 670 670 } 671 671 672 - conn->params.peer->last_tx_at = ktime_get_real(); 672 + conn->params.peer->last_tx_at = ktime_get_seconds(); 673 673 _leave(" = 0"); 674 674 return 0; 675 675 } ··· 725 725 return -EAGAIN; 726 726 } 727 727 728 - conn->params.peer->last_tx_at = ktime_get_real(); 728 + conn->params.peer->last_tx_at = ktime_get_seconds(); 729 729 _leave(" = 0"); 730 730 return 0; 731 731 }
+12 -7
net/smc/af_smc.c
··· 1122 1122 sock_hold(lsk); /* sock_put in smc_listen_work */ 1123 1123 INIT_WORK(&new_smc->smc_listen_work, smc_listen_work); 1124 1124 smc_copy_sock_settings_to_smc(new_smc); 1125 + new_smc->sk.sk_sndbuf = lsmc->sk.sk_sndbuf; 1126 + new_smc->sk.sk_rcvbuf = lsmc->sk.sk_rcvbuf; 1125 1127 sock_hold(&new_smc->sk); /* sock_put in passive closing */ 1126 1128 if (!schedule_work(&new_smc->smc_listen_work)) 1127 1129 sock_put(&new_smc->sk); ··· 1399 1397 lock_sock(sk); 1400 1398 1401 1399 rc = -ENOTCONN; 1402 - if ((sk->sk_state != SMC_LISTEN) && 1403 - (sk->sk_state != SMC_ACTIVE) && 1400 + if ((sk->sk_state != SMC_ACTIVE) && 1404 1401 (sk->sk_state != SMC_PEERCLOSEWAIT1) && 1405 1402 (sk->sk_state != SMC_PEERCLOSEWAIT2) && 1406 1403 (sk->sk_state != SMC_APPCLOSEWAIT1) && ··· 1522 1521 1523 1522 smc = smc_sk(sock->sk); 1524 1523 conn = &smc->conn; 1525 - if (smc->use_fallback) { 1526 - if (!smc->clcsock) 1527 - return -EBADF; 1528 - return smc->clcsock->ops->ioctl(smc->clcsock, cmd, arg); 1529 - } 1530 1524 lock_sock(&smc->sk); 1525 + if (smc->use_fallback) { 1526 + if (!smc->clcsock) { 1527 + release_sock(&smc->sk); 1528 + return -EBADF; 1529 + } 1530 + answ = smc->clcsock->ops->ioctl(smc->clcsock, cmd, arg); 1531 + release_sock(&smc->sk); 1532 + return answ; 1533 + } 1531 1534 switch (cmd) { 1532 1535 case SIOCINQ: /* same as FIONREAD */ 1533 1536 if (smc->sk.sk_state == SMC_LISTEN) {
+1 -3
net/tipc/net.c
··· 123 123 { 124 124 struct tipc_net *tn = tipc_net(net); 125 125 126 - spin_lock_bh(&tn->node_list_lock); 127 - if (!tipc_own_addr(net)) { 126 + if (!cmpxchg(&tn->node_addr, 0, addr)) { 128 127 tipc_set_node_addr(net, addr); 129 128 tipc_named_reinit(net); 130 129 tipc_sk_reinit(net); 131 130 tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, 132 131 TIPC_CLUSTER_SCOPE, 0, addr); 133 132 } 134 - spin_unlock_bh(&tn->node_list_lock); 135 133 } 136 134 137 135 void tipc_net_stop(struct net *net)
+8 -7
net/vmw_vsock/af_vsock.c
··· 451 451 return transport->shutdown(vsock_sk(sk), mode); 452 452 } 453 453 454 - void vsock_pending_work(struct work_struct *work) 454 + static void vsock_pending_work(struct work_struct *work) 455 455 { 456 456 struct sock *sk; 457 457 struct sock *listener; 458 458 struct vsock_sock *vsk; 459 459 bool cleanup; 460 460 461 - vsk = container_of(work, struct vsock_sock, dwork.work); 461 + vsk = container_of(work, struct vsock_sock, pending_work.work); 462 462 sk = sk_vsock(vsk); 463 463 listener = vsk->listener; 464 464 cleanup = true; ··· 498 498 sock_put(sk); 499 499 sock_put(listener); 500 500 } 501 - EXPORT_SYMBOL_GPL(vsock_pending_work); 502 501 503 502 /**** SOCKET OPERATIONS ****/ 504 503 ··· 596 597 return retval; 597 598 } 598 599 600 + static void vsock_connect_timeout(struct work_struct *work); 601 + 599 602 struct sock *__vsock_create(struct net *net, 600 603 struct socket *sock, 601 604 struct sock *parent, ··· 639 638 vsk->sent_request = false; 640 639 vsk->ignore_connecting_rst = false; 641 640 vsk->peer_shutdown = 0; 641 + INIT_DELAYED_WORK(&vsk->connect_work, vsock_connect_timeout); 642 + INIT_DELAYED_WORK(&vsk->pending_work, vsock_pending_work); 642 643 643 644 psk = parent ? vsock_sk(parent) : NULL; 644 645 if (parent) { ··· 1120 1117 struct vsock_sock *vsk; 1121 1118 int cancel = 0; 1122 1119 1123 - vsk = container_of(work, struct vsock_sock, dwork.work); 1120 + vsk = container_of(work, struct vsock_sock, connect_work.work); 1124 1121 sk = sk_vsock(vsk); 1125 1122 1126 1123 lock_sock(sk); ··· 1224 1221 * timeout fires. 1225 1222 */ 1226 1223 sock_hold(sk); 1227 - INIT_DELAYED_WORK(&vsk->dwork, 1228 - vsock_connect_timeout); 1229 - schedule_delayed_work(&vsk->dwork, timeout); 1224 + schedule_delayed_work(&vsk->connect_work, timeout); 1230 1225 1231 1226 /* Skip ahead to preserve error code set above. */ 1232 1227 goto out_wait;
+1 -2
net/vmw_vsock/vmci_transport.c
··· 1094 1094 vpending->listener = sk; 1095 1095 sock_hold(sk); 1096 1096 sock_hold(pending); 1097 - INIT_DELAYED_WORK(&vpending->dwork, vsock_pending_work); 1098 - schedule_delayed_work(&vpending->dwork, HZ); 1097 + schedule_delayed_work(&vpending->pending_work, HZ); 1099 1098 1100 1099 out: 1101 1100 return err;