aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c9
-rw-r--r--net/9p/trans_virtio.c9
-rw-r--r--net/bridge/br_device.c7
-rw-r--r--net/can/af_can.c2
-rw-r--r--net/ipv4/af_inet.c14
-rw-r--r--net/ipv4/fib_trie.c13
-rw-r--r--net/ipv4/ip_tunnel.c8
-rw-r--r--net/ipv4/ping.c15
-rw-r--r--net/ipv4/tcp_ipv4.c33
-rw-r--r--net/ipv4/udp.c15
-rw-r--r--net/ipv6/addrconf.c14
-rw-r--r--net/ipv6/af_inet6.c14
-rw-r--r--net/ipv6/ip6_gre.c15
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6_tunnel.c7
-rw-r--r--net/ipv6/sit.c15
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c25
-rw-r--r--net/netfilter/xt_set.c4
-rw-r--r--net/openvswitch/datapath.c6
-rw-r--r--net/openvswitch/vport.c8
-rw-r--r--net/phonet/socket.c24
-rw-r--r--net/sctp/objcnt.c9
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_unseal.c8
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_wrap.c10
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_upcall.c3
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_xdr.c29
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c4
-rw-r--r--net/sunrpc/clnt.c29
-rw-r--r--net/sunrpc/svc.c2
-rw-r--r--net/sunrpc/xprtsock.c28
-rw-r--r--net/vmw_vsock/Kconfig2
31 files changed, 264 insertions, 119 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8db1b985dbf1..762896ebfcf5 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -539,7 +539,7 @@ static const struct net_device_ops vlan_netdev_ops;
539static int vlan_dev_init(struct net_device *dev) 539static int vlan_dev_init(struct net_device *dev)
540{ 540{
541 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev; 541 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
542 int subclass = 0; 542 int subclass = 0, i;
543 543
544 netif_carrier_off(dev); 544 netif_carrier_off(dev);
545 545
@@ -593,6 +593,13 @@ static int vlan_dev_init(struct net_device *dev)
593 if (!vlan_dev_priv(dev)->vlan_pcpu_stats) 593 if (!vlan_dev_priv(dev)->vlan_pcpu_stats)
594 return -ENOMEM; 594 return -ENOMEM;
595 595
596 for_each_possible_cpu(i) {
597 struct vlan_pcpu_stats *vlan_stat;
598 vlan_stat = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i);
599 u64_stats_init(&vlan_stat->syncp);
600 }
601
602
596 return 0; 603 return 0;
597} 604}
598 605
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 990afab2be1b..9c5a1aa34d12 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -544,9 +544,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
544 544
545 chan->inuse = false; 545 chan->inuse = false;
546 if (virtio_has_feature(vdev, VIRTIO_9P_MOUNT_TAG)) { 546 if (virtio_has_feature(vdev, VIRTIO_9P_MOUNT_TAG)) {
547 vdev->config->get(vdev, 547 virtio_cread(vdev, struct virtio_9p_config, tag_len, &tag_len);
548 offsetof(struct virtio_9p_config, tag_len),
549 &tag_len, sizeof(tag_len));
550 } else { 548 } else {
551 err = -EINVAL; 549 err = -EINVAL;
552 goto out_free_vq; 550 goto out_free_vq;
@@ -556,8 +554,9 @@ static int p9_virtio_probe(struct virtio_device *vdev)
556 err = -ENOMEM; 554 err = -ENOMEM;
557 goto out_free_vq; 555 goto out_free_vq;
558 } 556 }
559 vdev->config->get(vdev, offsetof(struct virtio_9p_config, tag), 557
560 tag, tag_len); 558 virtio_cread_bytes(vdev, offsetof(struct virtio_9p_config, tag),
559 tag, tag_len);
561 chan->tag = tag; 560 chan->tag = tag;
562 chan->tag_len = tag_len; 561 chan->tag_len = tag_len;
563 err = sysfs_create_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); 562 err = sysfs_create_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr);
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index e6b7fecb3af1..f00cfd2a0143 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -88,11 +88,18 @@ out:
88static int br_dev_init(struct net_device *dev) 88static int br_dev_init(struct net_device *dev)
89{ 89{
90 struct net_bridge *br = netdev_priv(dev); 90 struct net_bridge *br = netdev_priv(dev);
91 int i;
91 92
92 br->stats = alloc_percpu(struct br_cpu_netstats); 93 br->stats = alloc_percpu(struct br_cpu_netstats);
93 if (!br->stats) 94 if (!br->stats)
94 return -ENOMEM; 95 return -ENOMEM;
95 96
97 for_each_possible_cpu(i) {
98 struct br_cpu_netstats *br_dev_stats;
99 br_dev_stats = per_cpu_ptr(br->stats, i);
100 u64_stats_init(&br_dev_stats->syncp);
101 }
102
96 return 0; 103 return 0;
97} 104}
98 105
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 3ab8dd2e1282..d249874a366d 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -420,7 +420,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,
420 * @mask: CAN mask (see description) 420 * @mask: CAN mask (see description)
421 * @func: callback function on filter match 421 * @func: callback function on filter match
422 * @data: returned parameter for callback function 422 * @data: returned parameter for callback function
423 * @ident: string for calling module indentification 423 * @ident: string for calling module identification
424 * 424 *
425 * Description: 425 * Description:
426 * Invokes the callback function with the received sk_buff and the given 426 * Invokes the callback function with the received sk_buff and the given
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 68af9aac91d0..70011e029ac1 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1503,6 +1503,7 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align)
1503 ptr[0] = __alloc_percpu(mibsize, align); 1503 ptr[0] = __alloc_percpu(mibsize, align);
1504 if (!ptr[0]) 1504 if (!ptr[0])
1505 return -ENOMEM; 1505 return -ENOMEM;
1506
1506#if SNMP_ARRAY_SZ == 2 1507#if SNMP_ARRAY_SZ == 2
1507 ptr[1] = __alloc_percpu(mibsize, align); 1508 ptr[1] = __alloc_percpu(mibsize, align);
1508 if (!ptr[1]) { 1509 if (!ptr[1]) {
@@ -1547,6 +1548,8 @@ static const struct net_protocol icmp_protocol = {
1547 1548
1548static __net_init int ipv4_mib_init_net(struct net *net) 1549static __net_init int ipv4_mib_init_net(struct net *net)
1549{ 1550{
1551 int i;
1552
1550 if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics, 1553 if (snmp_mib_init((void __percpu **)net->mib.tcp_statistics,
1551 sizeof(struct tcp_mib), 1554 sizeof(struct tcp_mib),
1552 __alignof__(struct tcp_mib)) < 0) 1555 __alignof__(struct tcp_mib)) < 0)
@@ -1555,6 +1558,17 @@ static __net_init int ipv4_mib_init_net(struct net *net)
1555 sizeof(struct ipstats_mib), 1558 sizeof(struct ipstats_mib),
1556 __alignof__(struct ipstats_mib)) < 0) 1559 __alignof__(struct ipstats_mib)) < 0)
1557 goto err_ip_mib; 1560 goto err_ip_mib;
1561
1562 for_each_possible_cpu(i) {
1563 struct ipstats_mib *af_inet_stats;
1564 af_inet_stats = per_cpu_ptr(net->mib.ip_statistics[0], i);
1565 u64_stats_init(&af_inet_stats->syncp);
1566#if SNMP_ARRAY_SZ == 2
1567 af_inet_stats = per_cpu_ptr(net->mib.ip_statistics[1], i);
1568 u64_stats_init(&af_inet_stats->syncp);
1569#endif
1570 }
1571
1558 if (snmp_mib_init((void __percpu **)net->mib.net_statistics, 1572 if (snmp_mib_init((void __percpu **)net->mib.net_statistics,
1559 sizeof(struct linux_mib), 1573 sizeof(struct linux_mib),
1560 __alignof__(struct linux_mib)) < 0) 1574 __alignof__(struct linux_mib)) < 0)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index ec9a9ef4ce50..5afeb5aa4c7c 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2523,16 +2523,17 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
2523 list_for_each_entry_rcu(fa, &li->falh, fa_list) { 2523 list_for_each_entry_rcu(fa, &li->falh, fa_list) {
2524 const struct fib_info *fi = fa->fa_info; 2524 const struct fib_info *fi = fa->fa_info;
2525 unsigned int flags = fib_flag_trans(fa->fa_type, mask, fi); 2525 unsigned int flags = fib_flag_trans(fa->fa_type, mask, fi);
2526 int len;
2527 2526
2528 if (fa->fa_type == RTN_BROADCAST 2527 if (fa->fa_type == RTN_BROADCAST
2529 || fa->fa_type == RTN_MULTICAST) 2528 || fa->fa_type == RTN_MULTICAST)
2530 continue; 2529 continue;
2531 2530
2531 seq_setwidth(seq, 127);
2532
2532 if (fi) 2533 if (fi)
2533 seq_printf(seq, 2534 seq_printf(seq,
2534 "%s\t%08X\t%08X\t%04X\t%d\t%u\t" 2535 "%s\t%08X\t%08X\t%04X\t%d\t%u\t"
2535 "%d\t%08X\t%d\t%u\t%u%n", 2536 "%d\t%08X\t%d\t%u\t%u",
2536 fi->fib_dev ? fi->fib_dev->name : "*", 2537 fi->fib_dev ? fi->fib_dev->name : "*",
2537 prefix, 2538 prefix,
2538 fi->fib_nh->nh_gw, flags, 0, 0, 2539 fi->fib_nh->nh_gw, flags, 0, 0,
@@ -2541,15 +2542,15 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
2541 (fi->fib_advmss ? 2542 (fi->fib_advmss ?
2542 fi->fib_advmss + 40 : 0), 2543 fi->fib_advmss + 40 : 0),
2543 fi->fib_window, 2544 fi->fib_window,
2544 fi->fib_rtt >> 3, &len); 2545 fi->fib_rtt >> 3);
2545 else 2546 else
2546 seq_printf(seq, 2547 seq_printf(seq,
2547 "*\t%08X\t%08X\t%04X\t%d\t%u\t" 2548 "*\t%08X\t%08X\t%04X\t%d\t%u\t"
2548 "%d\t%08X\t%d\t%u\t%u%n", 2549 "%d\t%08X\t%d\t%u\t%u",
2549 prefix, 0, flags, 0, 0, 0, 2550 prefix, 0, flags, 0, 0, 0,
2550 mask, 0, 0, 0, &len); 2551 mask, 0, 0, 0);
2551 2552
2552 seq_printf(seq, "%*s\n", 127 - len, ""); 2553 seq_pad(seq, '\n');
2553 } 2554 }
2554 } 2555 }
2555 2556
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 254f11c24aa5..90ff9570d7d4 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -976,13 +976,19 @@ int ip_tunnel_init(struct net_device *dev)
976{ 976{
977 struct ip_tunnel *tunnel = netdev_priv(dev); 977 struct ip_tunnel *tunnel = netdev_priv(dev);
978 struct iphdr *iph = &tunnel->parms.iph; 978 struct iphdr *iph = &tunnel->parms.iph;
979 int err; 979 int i, err;
980 980
981 dev->destructor = ip_tunnel_dev_free; 981 dev->destructor = ip_tunnel_dev_free;
982 dev->tstats = alloc_percpu(struct pcpu_tstats); 982 dev->tstats = alloc_percpu(struct pcpu_tstats);
983 if (!dev->tstats) 983 if (!dev->tstats)
984 return -ENOMEM; 984 return -ENOMEM;
985 985
986 for_each_possible_cpu(i) {
987 struct pcpu_tstats *ipt_stats;
988 ipt_stats = per_cpu_ptr(dev->tstats, i);
989 u64_stats_init(&ipt_stats->syncp);
990 }
991
986 err = gro_cells_init(&tunnel->gro_cells, dev); 992 err = gro_cells_init(&tunnel->gro_cells, dev);
987 if (err) { 993 if (err) {
988 free_percpu(dev->tstats); 994 free_percpu(dev->tstats);
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 91bfe0437e7a..876c6ca2d8f9 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -1075,7 +1075,7 @@ void ping_seq_stop(struct seq_file *seq, void *v)
1075EXPORT_SYMBOL_GPL(ping_seq_stop); 1075EXPORT_SYMBOL_GPL(ping_seq_stop);
1076 1076
1077static void ping_v4_format_sock(struct sock *sp, struct seq_file *f, 1077static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
1078 int bucket, int *len) 1078 int bucket)
1079{ 1079{
1080 struct inet_sock *inet = inet_sk(sp); 1080 struct inet_sock *inet = inet_sk(sp);
1081 __be32 dest = inet->inet_daddr; 1081 __be32 dest = inet->inet_daddr;
@@ -1084,7 +1084,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
1084 __u16 srcp = ntohs(inet->inet_sport); 1084 __u16 srcp = ntohs(inet->inet_sport);
1085 1085
1086 seq_printf(f, "%5d: %08X:%04X %08X:%04X" 1086 seq_printf(f, "%5d: %08X:%04X %08X:%04X"
1087 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n", 1087 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
1088 bucket, src, srcp, dest, destp, sp->sk_state, 1088 bucket, src, srcp, dest, destp, sp->sk_state,
1089 sk_wmem_alloc_get(sp), 1089 sk_wmem_alloc_get(sp),
1090 sk_rmem_alloc_get(sp), 1090 sk_rmem_alloc_get(sp),
@@ -1092,23 +1092,22 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
1092 from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), 1092 from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)),
1093 0, sock_i_ino(sp), 1093 0, sock_i_ino(sp),
1094 atomic_read(&sp->sk_refcnt), sp, 1094 atomic_read(&sp->sk_refcnt), sp,
1095 atomic_read(&sp->sk_drops), len); 1095 atomic_read(&sp->sk_drops));
1096} 1096}
1097 1097
1098static int ping_v4_seq_show(struct seq_file *seq, void *v) 1098static int ping_v4_seq_show(struct seq_file *seq, void *v)
1099{ 1099{
1100 seq_setwidth(seq, 127);
1100 if (v == SEQ_START_TOKEN) 1101 if (v == SEQ_START_TOKEN)
1101 seq_printf(seq, "%-127s\n", 1102 seq_puts(seq, " sl local_address rem_address st tx_queue "
1102 " sl local_address rem_address st tx_queue "
1103 "rx_queue tr tm->when retrnsmt uid timeout " 1103 "rx_queue tr tm->when retrnsmt uid timeout "
1104 "inode ref pointer drops"); 1104 "inode ref pointer drops");
1105 else { 1105 else {
1106 struct ping_iter_state *state = seq->private; 1106 struct ping_iter_state *state = seq->private;
1107 int len;
1108 1107
1109 ping_v4_format_sock(v, seq, state->bucket, &len); 1108 ping_v4_format_sock(v, seq, state->bucket);
1110 seq_printf(seq, "%*s\n", 127 - len, "");
1111 } 1109 }
1110 seq_pad(seq, '\n');
1112 return 0; 1111 return 0;
1113} 1112}
1114 1113
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 14bba8a1c5a7..59a6f8b90cd9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2541,13 +2541,13 @@ void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
2541EXPORT_SYMBOL(tcp_proc_unregister); 2541EXPORT_SYMBOL(tcp_proc_unregister);
2542 2542
2543static void get_openreq4(const struct sock *sk, const struct request_sock *req, 2543static void get_openreq4(const struct sock *sk, const struct request_sock *req,
2544 struct seq_file *f, int i, kuid_t uid, int *len) 2544 struct seq_file *f, int i, kuid_t uid)
2545{ 2545{
2546 const struct inet_request_sock *ireq = inet_rsk(req); 2546 const struct inet_request_sock *ireq = inet_rsk(req);
2547 long delta = req->expires - jiffies; 2547 long delta = req->expires - jiffies;
2548 2548
2549 seq_printf(f, "%4d: %08X:%04X %08X:%04X" 2549 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
2550 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n", 2550 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK",
2551 i, 2551 i,
2552 ireq->ir_loc_addr, 2552 ireq->ir_loc_addr,
2553 ntohs(inet_sk(sk)->inet_sport), 2553 ntohs(inet_sk(sk)->inet_sport),
@@ -2562,11 +2562,10 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
2562 0, /* non standard timer */ 2562 0, /* non standard timer */
2563 0, /* open_requests have no inode */ 2563 0, /* open_requests have no inode */
2564 atomic_read(&sk->sk_refcnt), 2564 atomic_read(&sk->sk_refcnt),
2565 req, 2565 req);
2566 len);
2567} 2566}
2568 2567
2569static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) 2568static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i)
2570{ 2569{
2571 int timer_active; 2570 int timer_active;
2572 unsigned long timer_expires; 2571 unsigned long timer_expires;
@@ -2605,7 +2604,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2605 rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); 2604 rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
2606 2605
2607 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " 2606 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
2608 "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d%n", 2607 "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d",
2609 i, src, srcp, dest, destp, sk->sk_state, 2608 i, src, srcp, dest, destp, sk->sk_state,
2610 tp->write_seq - tp->snd_una, 2609 tp->write_seq - tp->snd_una,
2611 rx_queue, 2610 rx_queue,
@@ -2622,12 +2621,11 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2622 tp->snd_cwnd, 2621 tp->snd_cwnd,
2623 sk->sk_state == TCP_LISTEN ? 2622 sk->sk_state == TCP_LISTEN ?
2624 (fastopenq ? fastopenq->max_qlen : 0) : 2623 (fastopenq ? fastopenq->max_qlen : 0) :
2625 (tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh), 2624 (tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh));
2626 len);
2627} 2625}
2628 2626
2629static void get_timewait4_sock(const struct inet_timewait_sock *tw, 2627static void get_timewait4_sock(const struct inet_timewait_sock *tw,
2630 struct seq_file *f, int i, int *len) 2628 struct seq_file *f, int i)
2631{ 2629{
2632 __be32 dest, src; 2630 __be32 dest, src;
2633 __u16 destp, srcp; 2631 __u16 destp, srcp;
@@ -2639,10 +2637,10 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
2639 srcp = ntohs(tw->tw_sport); 2637 srcp = ntohs(tw->tw_sport);
2640 2638
2641 seq_printf(f, "%4d: %08X:%04X %08X:%04X" 2639 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
2642 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK%n", 2640 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK",
2643 i, src, srcp, dest, destp, tw->tw_substate, 0, 0, 2641 i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
2644 3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0, 2642 3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0,
2645 atomic_read(&tw->tw_refcnt), tw, len); 2643 atomic_read(&tw->tw_refcnt), tw);
2646} 2644}
2647 2645
2648#define TMPSZ 150 2646#define TMPSZ 150
@@ -2651,11 +2649,10 @@ static int tcp4_seq_show(struct seq_file *seq, void *v)
2651{ 2649{
2652 struct tcp_iter_state *st; 2650 struct tcp_iter_state *st;
2653 struct sock *sk = v; 2651 struct sock *sk = v;
2654 int len;
2655 2652
2653 seq_setwidth(seq, TMPSZ - 1);
2656 if (v == SEQ_START_TOKEN) { 2654 if (v == SEQ_START_TOKEN) {
2657 seq_printf(seq, "%-*s\n", TMPSZ - 1, 2655 seq_puts(seq, " sl local_address rem_address st tx_queue "
2658 " sl local_address rem_address st tx_queue "
2659 "rx_queue tr tm->when retrnsmt uid timeout " 2656 "rx_queue tr tm->when retrnsmt uid timeout "
2660 "inode"); 2657 "inode");
2661 goto out; 2658 goto out;
@@ -2666,16 +2663,16 @@ static int tcp4_seq_show(struct seq_file *seq, void *v)
2666 case TCP_SEQ_STATE_LISTENING: 2663 case TCP_SEQ_STATE_LISTENING:
2667 case TCP_SEQ_STATE_ESTABLISHED: 2664 case TCP_SEQ_STATE_ESTABLISHED:
2668 if (sk->sk_state == TCP_TIME_WAIT) 2665 if (sk->sk_state == TCP_TIME_WAIT)
2669 get_timewait4_sock(v, seq, st->num, &len); 2666 get_timewait4_sock(v, seq, st->num);
2670 else 2667 else
2671 get_tcp4_sock(v, seq, st->num, &len); 2668 get_tcp4_sock(v, seq, st->num);
2672 break; 2669 break;
2673 case TCP_SEQ_STATE_OPENREQ: 2670 case TCP_SEQ_STATE_OPENREQ:
2674 get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid, &len); 2671 get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid);
2675 break; 2672 break;
2676 } 2673 }
2677 seq_printf(seq, "%*s\n", TMPSZ - 1 - len, "");
2678out: 2674out:
2675 seq_pad(seq, '\n');
2679 return 0; 2676 return 0;
2680} 2677}
2681 2678
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 998431cd471a..5944d7d668dd 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2326,7 +2326,7 @@ EXPORT_SYMBOL(udp_proc_unregister);
2326 2326
2327/* ------------------------------------------------------------------------ */ 2327/* ------------------------------------------------------------------------ */
2328static void udp4_format_sock(struct sock *sp, struct seq_file *f, 2328static void udp4_format_sock(struct sock *sp, struct seq_file *f,
2329 int bucket, int *len) 2329 int bucket)
2330{ 2330{
2331 struct inet_sock *inet = inet_sk(sp); 2331 struct inet_sock *inet = inet_sk(sp);
2332 __be32 dest = inet->inet_daddr; 2332 __be32 dest = inet->inet_daddr;
@@ -2335,7 +2335,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
2335 __u16 srcp = ntohs(inet->inet_sport); 2335 __u16 srcp = ntohs(inet->inet_sport);
2336 2336
2337 seq_printf(f, "%5d: %08X:%04X %08X:%04X" 2337 seq_printf(f, "%5d: %08X:%04X %08X:%04X"
2338 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n", 2338 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
2339 bucket, src, srcp, dest, destp, sp->sk_state, 2339 bucket, src, srcp, dest, destp, sp->sk_state,
2340 sk_wmem_alloc_get(sp), 2340 sk_wmem_alloc_get(sp),
2341 sk_rmem_alloc_get(sp), 2341 sk_rmem_alloc_get(sp),
@@ -2343,23 +2343,22 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
2343 from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), 2343 from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)),
2344 0, sock_i_ino(sp), 2344 0, sock_i_ino(sp),
2345 atomic_read(&sp->sk_refcnt), sp, 2345 atomic_read(&sp->sk_refcnt), sp,
2346 atomic_read(&sp->sk_drops), len); 2346 atomic_read(&sp->sk_drops));
2347} 2347}
2348 2348
2349int udp4_seq_show(struct seq_file *seq, void *v) 2349int udp4_seq_show(struct seq_file *seq, void *v)
2350{ 2350{
2351 seq_setwidth(seq, 127);
2351 if (v == SEQ_START_TOKEN) 2352 if (v == SEQ_START_TOKEN)
2352 seq_printf(seq, "%-127s\n", 2353 seq_puts(seq, " sl local_address rem_address st tx_queue "
2353 " sl local_address rem_address st tx_queue "
2354 "rx_queue tr tm->when retrnsmt uid timeout " 2354 "rx_queue tr tm->when retrnsmt uid timeout "
2355 "inode ref pointer drops"); 2355 "inode ref pointer drops");
2356 else { 2356 else {
2357 struct udp_iter_state *state = seq->private; 2357 struct udp_iter_state *state = seq->private;
2358 int len;
2359 2358
2360 udp4_format_sock(v, seq, state->bucket, &len); 2359 udp4_format_sock(v, seq, state->bucket);
2361 seq_printf(seq, "%*s\n", 127 - len, "");
2362 } 2360 }
2361 seq_pad(seq, '\n');
2363 return 0; 2362 return 0;
2364} 2363}
2365 2364
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index cdc14d0947f3..12c97d8aa6bb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -271,10 +271,24 @@ static void addrconf_mod_dad_timer(struct inet6_ifaddr *ifp,
271 271
272static int snmp6_alloc_dev(struct inet6_dev *idev) 272static int snmp6_alloc_dev(struct inet6_dev *idev)
273{ 273{
274 int i;
275
274 if (snmp_mib_init((void __percpu **)idev->stats.ipv6, 276 if (snmp_mib_init((void __percpu **)idev->stats.ipv6,
275 sizeof(struct ipstats_mib), 277 sizeof(struct ipstats_mib),
276 __alignof__(struct ipstats_mib)) < 0) 278 __alignof__(struct ipstats_mib)) < 0)
277 goto err_ip; 279 goto err_ip;
280
281 for_each_possible_cpu(i) {
282 struct ipstats_mib *addrconf_stats;
283 addrconf_stats = per_cpu_ptr(idev->stats.ipv6[0], i);
284 u64_stats_init(&addrconf_stats->syncp);
285#if SNMP_ARRAY_SZ == 2
286 addrconf_stats = per_cpu_ptr(idev->stats.ipv6[1], i);
287 u64_stats_init(&addrconf_stats->syncp);
288#endif
289 }
290
291
278 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), 292 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device),
279 GFP_KERNEL); 293 GFP_KERNEL);
280 if (!idev->stats.icmpv6dev) 294 if (!idev->stats.icmpv6dev)
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 56ca35b30dda..4fbdb7046d28 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -714,6 +714,8 @@ static void ipv6_packet_cleanup(void)
714 714
715static int __net_init ipv6_init_mibs(struct net *net) 715static int __net_init ipv6_init_mibs(struct net *net)
716{ 716{
717 int i;
718
717 if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6, 719 if (snmp_mib_init((void __percpu **)net->mib.udp_stats_in6,
718 sizeof(struct udp_mib), 720 sizeof(struct udp_mib),
719 __alignof__(struct udp_mib)) < 0) 721 __alignof__(struct udp_mib)) < 0)
@@ -726,6 +728,18 @@ static int __net_init ipv6_init_mibs(struct net *net)
726 sizeof(struct ipstats_mib), 728 sizeof(struct ipstats_mib),
727 __alignof__(struct ipstats_mib)) < 0) 729 __alignof__(struct ipstats_mib)) < 0)
728 goto err_ip_mib; 730 goto err_ip_mib;
731
732 for_each_possible_cpu(i) {
733 struct ipstats_mib *af_inet6_stats;
734 af_inet6_stats = per_cpu_ptr(net->mib.ipv6_statistics[0], i);
735 u64_stats_init(&af_inet6_stats->syncp);
736#if SNMP_ARRAY_SZ == 2
737 af_inet6_stats = per_cpu_ptr(net->mib.ipv6_statistics[1], i);
738 u64_stats_init(&af_inet6_stats->syncp);
739#endif
740 }
741
742
729 if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics, 743 if (snmp_mib_init((void __percpu **)net->mib.icmpv6_statistics,
730 sizeof(struct icmpv6_mib), 744 sizeof(struct icmpv6_mib),
731 __alignof__(struct icmpv6_mib)) < 0) 745 __alignof__(struct icmpv6_mib)) < 0)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bf4a9a084de5..8acb28621f9c 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1252,6 +1252,7 @@ static void ip6gre_tunnel_setup(struct net_device *dev)
1252static int ip6gre_tunnel_init(struct net_device *dev) 1252static int ip6gre_tunnel_init(struct net_device *dev)
1253{ 1253{
1254 struct ip6_tnl *tunnel; 1254 struct ip6_tnl *tunnel;
1255 int i;
1255 1256
1256 tunnel = netdev_priv(dev); 1257 tunnel = netdev_priv(dev);
1257 1258
@@ -1269,6 +1270,13 @@ static int ip6gre_tunnel_init(struct net_device *dev)
1269 if (!dev->tstats) 1270 if (!dev->tstats)
1270 return -ENOMEM; 1271 return -ENOMEM;
1271 1272
1273 for_each_possible_cpu(i) {
1274 struct pcpu_tstats *ip6gre_tunnel_stats;
1275 ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i);
1276 u64_stats_init(&ip6gre_tunnel_stats->syncp);
1277 }
1278
1279
1272 return 0; 1280 return 0;
1273} 1281}
1274 1282
@@ -1449,6 +1457,7 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
1449static int ip6gre_tap_init(struct net_device *dev) 1457static int ip6gre_tap_init(struct net_device *dev)
1450{ 1458{
1451 struct ip6_tnl *tunnel; 1459 struct ip6_tnl *tunnel;
1460 int i;
1452 1461
1453 tunnel = netdev_priv(dev); 1462 tunnel = netdev_priv(dev);
1454 1463
@@ -1462,6 +1471,12 @@ static int ip6gre_tap_init(struct net_device *dev)
1462 if (!dev->tstats) 1471 if (!dev->tstats)
1463 return -ENOMEM; 1472 return -ENOMEM;
1464 1473
1474 for_each_possible_cpu(i) {
1475 struct pcpu_tstats *ip6gre_tap_stats;
1476 ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i);
1477 u64_stats_init(&ip6gre_tap_stats->syncp);
1478 }
1479
1465 return 0; 1480 return 0;
1466} 1481}
1467 1482
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5e31a909a2b0..59df872e2f4d 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -910,7 +910,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
910 910
911out_err_release: 911out_err_release:
912 if (err == -ENETUNREACH) 912 if (err == -ENETUNREACH)
913 IP6_INC_STATS_BH(net, NULL, IPSTATS_MIB_OUTNOROUTES); 913 IP6_INC_STATS(net, NULL, IPSTATS_MIB_OUTNOROUTES);
914 dst_release(*dst); 914 dst_release(*dst);
915 *dst = NULL; 915 *dst = NULL;
916 return err; 916 return err;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index c1e11b5d6ccc..d6062325db08 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1494,12 +1494,19 @@ static inline int
1494ip6_tnl_dev_init_gen(struct net_device *dev) 1494ip6_tnl_dev_init_gen(struct net_device *dev)
1495{ 1495{
1496 struct ip6_tnl *t = netdev_priv(dev); 1496 struct ip6_tnl *t = netdev_priv(dev);
1497 int i;
1497 1498
1498 t->dev = dev; 1499 t->dev = dev;
1499 t->net = dev_net(dev); 1500 t->net = dev_net(dev);
1500 dev->tstats = alloc_percpu(struct pcpu_tstats); 1501 dev->tstats = alloc_percpu(struct pcpu_tstats);
1501 if (!dev->tstats) 1502 if (!dev->tstats)
1502 return -ENOMEM; 1503 return -ENOMEM;
1504
1505 for_each_possible_cpu(i) {
1506 struct pcpu_tstats *ip6_tnl_stats;
1507 ip6_tnl_stats = per_cpu_ptr(dev->tstats, i);
1508 u64_stats_init(&ip6_tnl_stats->syncp);
1509 }
1503 return 0; 1510 return 0;
1504} 1511}
1505 1512
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 5a57f38a50d5..1b4a4a953675 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1320,6 +1320,7 @@ static void ipip6_tunnel_setup(struct net_device *dev)
1320static int ipip6_tunnel_init(struct net_device *dev) 1320static int ipip6_tunnel_init(struct net_device *dev)
1321{ 1321{
1322 struct ip_tunnel *tunnel = netdev_priv(dev); 1322 struct ip_tunnel *tunnel = netdev_priv(dev);
1323 int i;
1323 1324
1324 tunnel->dev = dev; 1325 tunnel->dev = dev;
1325 tunnel->net = dev_net(dev); 1326 tunnel->net = dev_net(dev);
@@ -1332,6 +1333,12 @@ static int ipip6_tunnel_init(struct net_device *dev)
1332 if (!dev->tstats) 1333 if (!dev->tstats)
1333 return -ENOMEM; 1334 return -ENOMEM;
1334 1335
1336 for_each_possible_cpu(i) {
1337 struct pcpu_tstats *ipip6_tunnel_stats;
1338 ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i);
1339 u64_stats_init(&ipip6_tunnel_stats->syncp);
1340 }
1341
1335 return 0; 1342 return 0;
1336} 1343}
1337 1344
@@ -1341,6 +1348,7 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1341 struct iphdr *iph = &tunnel->parms.iph; 1348 struct iphdr *iph = &tunnel->parms.iph;
1342 struct net *net = dev_net(dev); 1349 struct net *net = dev_net(dev);
1343 struct sit_net *sitn = net_generic(net, sit_net_id); 1350 struct sit_net *sitn = net_generic(net, sit_net_id);
1351 int i;
1344 1352
1345 tunnel->dev = dev; 1353 tunnel->dev = dev;
1346 tunnel->net = dev_net(dev); 1354 tunnel->net = dev_net(dev);
@@ -1354,6 +1362,13 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1354 dev->tstats = alloc_percpu(struct pcpu_tstats); 1362 dev->tstats = alloc_percpu(struct pcpu_tstats);
1355 if (!dev->tstats) 1363 if (!dev->tstats)
1356 return -ENOMEM; 1364 return -ENOMEM;
1365
1366 for_each_possible_cpu(i) {
1367 struct pcpu_tstats *ipip6_fb_stats;
1368 ipip6_fb_stats = per_cpu_ptr(dev->tstats, i);
1369 u64_stats_init(&ipip6_fb_stats->syncp);
1370 }
1371
1357 dev_hold(dev); 1372 dev_hold(dev);
1358 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); 1373 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
1359 return 0; 1374 return 0;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 393498704691..35be035ee0ce 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -842,7 +842,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
842 struct ip_vs_dest **dest_p) 842 struct ip_vs_dest **dest_p)
843{ 843{
844 struct ip_vs_dest *dest; 844 struct ip_vs_dest *dest;
845 unsigned int atype; 845 unsigned int atype, i;
846 846
847 EnterFunction(2); 847 EnterFunction(2);
848 848
@@ -869,6 +869,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
869 if (!dest->stats.cpustats) 869 if (!dest->stats.cpustats)
870 goto err_alloc; 870 goto err_alloc;
871 871
872 for_each_possible_cpu(i) {
873 struct ip_vs_cpu_stats *ip_vs_dest_stats;
874 ip_vs_dest_stats = per_cpu_ptr(dest->stats.cpustats, i);
875 u64_stats_init(&ip_vs_dest_stats->syncp);
876 }
877
872 dest->af = svc->af; 878 dest->af = svc->af;
873 dest->protocol = svc->protocol; 879 dest->protocol = svc->protocol;
874 dest->vaddr = svc->addr; 880 dest->vaddr = svc->addr;
@@ -1134,7 +1140,7 @@ static int
1134ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, 1140ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1135 struct ip_vs_service **svc_p) 1141 struct ip_vs_service **svc_p)
1136{ 1142{
1137 int ret = 0; 1143 int ret = 0, i;
1138 struct ip_vs_scheduler *sched = NULL; 1144 struct ip_vs_scheduler *sched = NULL;
1139 struct ip_vs_pe *pe = NULL; 1145 struct ip_vs_pe *pe = NULL;
1140 struct ip_vs_service *svc = NULL; 1146 struct ip_vs_service *svc = NULL;
@@ -1184,6 +1190,13 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1184 goto out_err; 1190 goto out_err;
1185 } 1191 }
1186 1192
1193 for_each_possible_cpu(i) {
1194 struct ip_vs_cpu_stats *ip_vs_stats;
1195 ip_vs_stats = per_cpu_ptr(svc->stats.cpustats, i);
1196 u64_stats_init(&ip_vs_stats->syncp);
1197 }
1198
1199
1187 /* I'm the first user of the service */ 1200 /* I'm the first user of the service */
1188 atomic_set(&svc->refcnt, 0); 1201 atomic_set(&svc->refcnt, 0);
1189 1202
@@ -3780,7 +3793,7 @@ static struct notifier_block ip_vs_dst_notifier = {
3780 3793
3781int __net_init ip_vs_control_net_init(struct net *net) 3794int __net_init ip_vs_control_net_init(struct net *net)
3782{ 3795{
3783 int idx; 3796 int i, idx;
3784 struct netns_ipvs *ipvs = net_ipvs(net); 3797 struct netns_ipvs *ipvs = net_ipvs(net);
3785 3798
3786 /* Initialize rs_table */ 3799 /* Initialize rs_table */
@@ -3799,6 +3812,12 @@ int __net_init ip_vs_control_net_init(struct net *net)
3799 if (!ipvs->tot_stats.cpustats) 3812 if (!ipvs->tot_stats.cpustats)
3800 return -ENOMEM; 3813 return -ENOMEM;
3801 3814
3815 for_each_possible_cpu(i) {
3816 struct ip_vs_cpu_stats *ipvs_tot_stats;
3817 ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats.cpustats, i);
3818 u64_stats_init(&ipvs_tot_stats->syncp);
3819 }
3820
3802 spin_lock_init(&ipvs->tot_stats.lock); 3821 spin_lock_init(&ipvs->tot_stats.lock);
3803 3822
3804 proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops); 3823 proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops);
diff --git a/net/netfilter/xt_set.c b/net/netfilter/xt_set.c
index e7c4e0e01ff5..80c2e2d603e0 100644
--- a/net/netfilter/xt_set.c
+++ b/net/netfilter/xt_set.c
@@ -84,7 +84,7 @@ set_match_v0_checkentry(const struct xt_mtchk_param *par)
84 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index); 84 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
85 85
86 if (index == IPSET_INVALID_ID) { 86 if (index == IPSET_INVALID_ID) {
87 pr_warning("Cannot find set indentified by id %u to match\n", 87 pr_warning("Cannot find set identified by id %u to match\n",
88 info->match_set.index); 88 info->match_set.index);
89 return -ENOENT; 89 return -ENOENT;
90 } 90 }
@@ -134,7 +134,7 @@ set_match_v1_checkentry(const struct xt_mtchk_param *par)
134 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index); 134 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
135 135
136 if (index == IPSET_INVALID_ID) { 136 if (index == IPSET_INVALID_ID) {
137 pr_warning("Cannot find set indentified by id %u to match\n", 137 pr_warning("Cannot find set identified by id %u to match\n",
138 info->match_set.index); 138 info->match_set.index);
139 return -ENOENT; 139 return -ENOENT;
140 } 140 }
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 1de4d281e3f1..6f5e1dd3be2d 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1199,6 +1199,12 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
1199 goto err_destroy_table; 1199 goto err_destroy_table;
1200 } 1200 }
1201 1201
1202 for_each_possible_cpu(i) {
1203 struct dp_stats_percpu *dpath_stats;
1204 dpath_stats = per_cpu_ptr(dp->stats_percpu, i);
1205 u64_stats_init(&dpath_stats->sync);
1206 }
1207
1202 dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), 1208 dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
1203 GFP_KERNEL); 1209 GFP_KERNEL);
1204 if (!dp->ports) { 1210 if (!dp->ports) {
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 6f65dbe13812..d830a95f03a4 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -118,6 +118,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
118{ 118{
119 struct vport *vport; 119 struct vport *vport;
120 size_t alloc_size; 120 size_t alloc_size;
121 int i;
121 122
122 alloc_size = sizeof(struct vport); 123 alloc_size = sizeof(struct vport);
123 if (priv_size) { 124 if (priv_size) {
@@ -141,6 +142,13 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
141 return ERR_PTR(-ENOMEM); 142 return ERR_PTR(-ENOMEM);
142 } 143 }
143 144
145 for_each_possible_cpu(i) {
146 struct pcpu_tstats *vport_stats;
147 vport_stats = per_cpu_ptr(vport->percpu_stats, i);
148 u64_stats_init(&vport_stats->syncp);
149 }
150
151
144 spin_lock_init(&vport->stats_lock); 152 spin_lock_init(&vport->stats_lock);
145 153
146 return vport; 154 return vport;
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 77e38f733496..008214a3d5eb 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -595,26 +595,25 @@ static void pn_sock_seq_stop(struct seq_file *seq, void *v)
595 595
596static int pn_sock_seq_show(struct seq_file *seq, void *v) 596static int pn_sock_seq_show(struct seq_file *seq, void *v)
597{ 597{
598 int len; 598 seq_setwidth(seq, 127);
599
600 if (v == SEQ_START_TOKEN) 599 if (v == SEQ_START_TOKEN)
601 seq_printf(seq, "%s%n", "pt loc rem rs st tx_queue rx_queue " 600 seq_puts(seq, "pt loc rem rs st tx_queue rx_queue "
602 " uid inode ref pointer drops", &len); 601 " uid inode ref pointer drops");
603 else { 602 else {
604 struct sock *sk = v; 603 struct sock *sk = v;
605 struct pn_sock *pn = pn_sk(sk); 604 struct pn_sock *pn = pn_sk(sk);
606 605
607 seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu " 606 seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu "
608 "%d %pK %d%n", 607 "%d %pK %d",
609 sk->sk_protocol, pn->sobject, pn->dobject, 608 sk->sk_protocol, pn->sobject, pn->dobject,
610 pn->resource, sk->sk_state, 609 pn->resource, sk->sk_state,
611 sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk), 610 sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk),
612 from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)), 611 from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
613 sock_i_ino(sk), 612 sock_i_ino(sk),
614 atomic_read(&sk->sk_refcnt), sk, 613 atomic_read(&sk->sk_refcnt), sk,
615 atomic_read(&sk->sk_drops), &len); 614 atomic_read(&sk->sk_drops));
616 } 615 }
617 seq_printf(seq, "%*s\n", 127 - len, ""); 616 seq_pad(seq, '\n');
618 return 0; 617 return 0;
619} 618}
620 619
@@ -785,20 +784,19 @@ static void pn_res_seq_stop(struct seq_file *seq, void *v)
785 784
786static int pn_res_seq_show(struct seq_file *seq, void *v) 785static int pn_res_seq_show(struct seq_file *seq, void *v)
787{ 786{
788 int len; 787 seq_setwidth(seq, 63);
789
790 if (v == SEQ_START_TOKEN) 788 if (v == SEQ_START_TOKEN)
791 seq_printf(seq, "%s%n", "rs uid inode", &len); 789 seq_puts(seq, "rs uid inode");
792 else { 790 else {
793 struct sock **psk = v; 791 struct sock **psk = v;
794 struct sock *sk = *psk; 792 struct sock *sk = *psk;
795 793
796 seq_printf(seq, "%02X %5u %lu%n", 794 seq_printf(seq, "%02X %5u %lu",
797 (int) (psk - pnres.sk), 795 (int) (psk - pnres.sk),
798 from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)), 796 from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
799 sock_i_ino(sk), &len); 797 sock_i_ino(sk));
800 } 798 }
801 seq_printf(seq, "%*s\n", 63 - len, ""); 799 seq_pad(seq, '\n');
802 return 0; 800 return 0;
803} 801}
804 802
diff --git a/net/sctp/objcnt.c b/net/sctp/objcnt.c
index 5ea573b37648..647396baa56f 100644
--- a/net/sctp/objcnt.c
+++ b/net/sctp/objcnt.c
@@ -79,12 +79,13 @@ static sctp_dbg_objcnt_entry_t sctp_dbg_objcnt[] = {
79 */ 79 */
80static int sctp_objcnt_seq_show(struct seq_file *seq, void *v) 80static int sctp_objcnt_seq_show(struct seq_file *seq, void *v)
81{ 81{
82 int i, len; 82 int i;
83 83
84 i = (int)*(loff_t *)v; 84 i = (int)*(loff_t *)v;
85 seq_printf(seq, "%s: %d%n", sctp_dbg_objcnt[i].label, 85 seq_setwidth(seq, 127);
86 atomic_read(sctp_dbg_objcnt[i].counter), &len); 86 seq_printf(seq, "%s: %d", sctp_dbg_objcnt[i].label,
87 seq_printf(seq, "%*s\n", 127 - len, ""); 87 atomic_read(sctp_dbg_objcnt[i].counter));
88 seq_pad(seq, '\n');
88 return 0; 89 return 0;
89} 90}
90 91
diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c
index 6cd930f3678f..6c981ddc19f8 100644
--- a/net/sunrpc/auth_gss/gss_krb5_unseal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c
@@ -150,7 +150,6 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,
150 struct xdr_netobj cksumobj = {.len = sizeof(cksumdata), 150 struct xdr_netobj cksumobj = {.len = sizeof(cksumdata),
151 .data = cksumdata}; 151 .data = cksumdata};
152 s32 now; 152 s32 now;
153 u64 seqnum;
154 u8 *ptr = read_token->data; 153 u8 *ptr = read_token->data;
155 u8 *cksumkey; 154 u8 *cksumkey;
156 u8 flags; 155 u8 flags;
@@ -197,9 +196,10 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,
197 if (now > ctx->endtime) 196 if (now > ctx->endtime)
198 return GSS_S_CONTEXT_EXPIRED; 197 return GSS_S_CONTEXT_EXPIRED;
199 198
200 /* do sequencing checks */ 199 /*
201 200 * NOTE: the sequence number at ptr + 8 is skipped, rpcsec_gss
202 seqnum = be64_to_cpup((__be64 *)ptr + 8); 201 * doesn't want it checked; see page 6 of rfc 2203.
202 */
203 203
204 return GSS_S_COMPLETE; 204 return GSS_S_COMPLETE;
205} 205}
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 1da52d1406fc..42560e55d978 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -489,7 +489,6 @@ static u32
489gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) 489gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)
490{ 490{
491 s32 now; 491 s32 now;
492 u64 seqnum;
493 u8 *ptr; 492 u8 *ptr;
494 u8 flags = 0x00; 493 u8 flags = 0x00;
495 u16 ec, rrc; 494 u16 ec, rrc;
@@ -525,7 +524,10 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)
525 ec = be16_to_cpup((__be16 *)(ptr + 4)); 524 ec = be16_to_cpup((__be16 *)(ptr + 4));
526 rrc = be16_to_cpup((__be16 *)(ptr + 6)); 525 rrc = be16_to_cpup((__be16 *)(ptr + 6));
527 526
528 seqnum = be64_to_cpup((__be64 *)(ptr + 8)); 527 /*
528 * NOTE: the sequence number at ptr + 8 is skipped, rpcsec_gss
529 * doesn't want it checked; see page 6 of rfc 2203.
530 */
529 531
530 if (rrc != 0) 532 if (rrc != 0)
531 rotate_left(offset + 16, buf, rrc); 533 rotate_left(offset + 16, buf, rrc);
@@ -574,8 +576,8 @@ gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)
574 buf->head[0].iov_len -= GSS_KRB5_TOK_HDR_LEN + headskip; 576 buf->head[0].iov_len -= GSS_KRB5_TOK_HDR_LEN + headskip;
575 buf->len -= GSS_KRB5_TOK_HDR_LEN + headskip; 577 buf->len -= GSS_KRB5_TOK_HDR_LEN + headskip;
576 578
577 /* Trim off the checksum blob */ 579 /* Trim off the trailing "extra count" and checksum blob */
578 xdr_buf_trim(buf, GSS_KRB5_TOK_HDR_LEN + tailskip); 580 xdr_buf_trim(buf, ec + GSS_KRB5_TOK_HDR_LEN + tailskip);
579 return GSS_S_COMPLETE; 581 return GSS_S_COMPLETE;
580} 582}
581 583
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c
index f1eb0d16666c..458f85e9b0ba 100644
--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -298,7 +298,8 @@ int gssp_accept_sec_context_upcall(struct net *net,
298 if (res.context_handle) { 298 if (res.context_handle) {
299 data->out_handle = rctxh.exported_context_token; 299 data->out_handle = rctxh.exported_context_token;
300 data->mech_oid.len = rctxh.mech.len; 300 data->mech_oid.len = rctxh.mech.len;
301 memcpy(data->mech_oid.data, rctxh.mech.data, 301 if (rctxh.mech.data)
302 memcpy(data->mech_oid.data, rctxh.mech.data,
302 data->mech_oid.len); 303 data->mech_oid.len);
303 client_name = rctxh.src_name.display_name; 304 client_name = rctxh.src_name.display_name;
304 } 305 }
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c
index f0f78c5f1c7d..1ec19f6f0c2b 100644
--- a/net/sunrpc/auth_gss/gss_rpc_xdr.c
+++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c
@@ -559,6 +559,8 @@ static int gssx_enc_cred(struct xdr_stream *xdr,
559 559
560 /* cred->elements */ 560 /* cred->elements */
561 err = dummy_enc_credel_array(xdr, &cred->elements); 561 err = dummy_enc_credel_array(xdr, &cred->elements);
562 if (err)
563 return err;
562 564
563 /* cred->cred_handle_reference */ 565 /* cred->cred_handle_reference */
564 err = gssx_enc_buffer(xdr, &cred->cred_handle_reference); 566 err = gssx_enc_buffer(xdr, &cred->cred_handle_reference);
@@ -740,22 +742,20 @@ void gssx_enc_accept_sec_context(struct rpc_rqst *req,
740 goto done; 742 goto done;
741 743
742 /* arg->context_handle */ 744 /* arg->context_handle */
743 if (arg->context_handle) { 745 if (arg->context_handle)
744 err = gssx_enc_ctx(xdr, arg->context_handle); 746 err = gssx_enc_ctx(xdr, arg->context_handle);
745 if (err) 747 else
746 goto done;
747 } else {
748 err = gssx_enc_bool(xdr, 0); 748 err = gssx_enc_bool(xdr, 0);
749 } 749 if (err)
750 goto done;
750 751
751 /* arg->cred_handle */ 752 /* arg->cred_handle */
752 if (arg->cred_handle) { 753 if (arg->cred_handle)
753 err = gssx_enc_cred(xdr, arg->cred_handle); 754 err = gssx_enc_cred(xdr, arg->cred_handle);
754 if (err) 755 else
755 goto done;
756 } else {
757 err = gssx_enc_bool(xdr, 0); 756 err = gssx_enc_bool(xdr, 0);
758 } 757 if (err)
758 goto done;
759 759
760 /* arg->input_token */ 760 /* arg->input_token */
761 err = gssx_enc_in_token(xdr, &arg->input_token); 761 err = gssx_enc_in_token(xdr, &arg->input_token);
@@ -763,13 +763,12 @@ void gssx_enc_accept_sec_context(struct rpc_rqst *req,
763 goto done; 763 goto done;
764 764
765 /* arg->input_cb */ 765 /* arg->input_cb */
766 if (arg->input_cb) { 766 if (arg->input_cb)
767 err = gssx_enc_cb(xdr, arg->input_cb); 767 err = gssx_enc_cb(xdr, arg->input_cb);
768 if (err) 768 else
769 goto done;
770 } else {
771 err = gssx_enc_bool(xdr, 0); 769 err = gssx_enc_bool(xdr, 0);
772 } 770 if (err)
771 goto done;
773 772
774 err = gssx_enc_bool(xdr, arg->ret_deleg_cred); 773 err = gssx_enc_bool(xdr, arg->ret_deleg_cred);
775 if (err) 774 if (err)
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 09fb638bcaa4..008cdade5aae 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1167,8 +1167,8 @@ static int gss_proxy_save_rsc(struct cache_detail *cd,
1167 if (!ud->found_creds) { 1167 if (!ud->found_creds) {
1168 /* userspace seem buggy, we should always get at least a 1168 /* userspace seem buggy, we should always get at least a
1169 * mapping to nobody */ 1169 * mapping to nobody */
1170 dprintk("RPC: No creds found, marking Negative!\n"); 1170 dprintk("RPC: No creds found!\n");
1171 set_bit(CACHE_NEGATIVE, &rsci.h.flags); 1171 goto out;
1172 } else { 1172 } else {
1173 1173
1174 /* steal creds */ 1174 /* steal creds */
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index dab09dac8fc7..f09b7db2c492 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -750,14 +750,16 @@ EXPORT_SYMBOL_GPL(rpc_shutdown_client);
750/* 750/*
751 * Free an RPC client 751 * Free an RPC client
752 */ 752 */
753static void 753static struct rpc_clnt *
754rpc_free_client(struct rpc_clnt *clnt) 754rpc_free_client(struct rpc_clnt *clnt)
755{ 755{
756 struct rpc_clnt *parent = NULL;
757
756 dprintk_rcu("RPC: destroying %s client for %s\n", 758 dprintk_rcu("RPC: destroying %s client for %s\n",
757 clnt->cl_program->name, 759 clnt->cl_program->name,
758 rcu_dereference(clnt->cl_xprt)->servername); 760 rcu_dereference(clnt->cl_xprt)->servername);
759 if (clnt->cl_parent != clnt) 761 if (clnt->cl_parent != clnt)
760 rpc_release_client(clnt->cl_parent); 762 parent = clnt->cl_parent;
761 rpc_clnt_remove_pipedir(clnt); 763 rpc_clnt_remove_pipedir(clnt);
762 rpc_unregister_client(clnt); 764 rpc_unregister_client(clnt);
763 rpc_free_iostats(clnt->cl_metrics); 765 rpc_free_iostats(clnt->cl_metrics);
@@ -766,18 +768,17 @@ rpc_free_client(struct rpc_clnt *clnt)
766 rpciod_down(); 768 rpciod_down();
767 rpc_free_clid(clnt); 769 rpc_free_clid(clnt);
768 kfree(clnt); 770 kfree(clnt);
771 return parent;
769} 772}
770 773
771/* 774/*
772 * Free an RPC client 775 * Free an RPC client
773 */ 776 */
774static void 777static struct rpc_clnt *
775rpc_free_auth(struct rpc_clnt *clnt) 778rpc_free_auth(struct rpc_clnt *clnt)
776{ 779{
777 if (clnt->cl_auth == NULL) { 780 if (clnt->cl_auth == NULL)
778 rpc_free_client(clnt); 781 return rpc_free_client(clnt);
779 return;
780 }
781 782
782 /* 783 /*
783 * Note: RPCSEC_GSS may need to send NULL RPC calls in order to 784 * Note: RPCSEC_GSS may need to send NULL RPC calls in order to
@@ -788,7 +789,8 @@ rpc_free_auth(struct rpc_clnt *clnt)
788 rpcauth_release(clnt->cl_auth); 789 rpcauth_release(clnt->cl_auth);
789 clnt->cl_auth = NULL; 790 clnt->cl_auth = NULL;
790 if (atomic_dec_and_test(&clnt->cl_count)) 791 if (atomic_dec_and_test(&clnt->cl_count))
791 rpc_free_client(clnt); 792 return rpc_free_client(clnt);
793 return NULL;
792} 794}
793 795
794/* 796/*
@@ -799,10 +801,13 @@ rpc_release_client(struct rpc_clnt *clnt)
799{ 801{
800 dprintk("RPC: rpc_release_client(%p)\n", clnt); 802 dprintk("RPC: rpc_release_client(%p)\n", clnt);
801 803
802 if (list_empty(&clnt->cl_tasks)) 804 do {
803 wake_up(&destroy_wait); 805 if (list_empty(&clnt->cl_tasks))
804 if (atomic_dec_and_test(&clnt->cl_count)) 806 wake_up(&destroy_wait);
805 rpc_free_auth(clnt); 807 if (!atomic_dec_and_test(&clnt->cl_count))
808 break;
809 clnt = rpc_free_auth(clnt);
810 } while (clnt != NULL);
806} 811}
807EXPORT_SYMBOL_GPL(rpc_release_client); 812EXPORT_SYMBOL_GPL(rpc_release_client);
808 813
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index b974571126fe..e7fbe368b4a3 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1104,8 +1104,6 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1104 rqstp->rq_vers = vers = svc_getnl(argv); /* version number */ 1104 rqstp->rq_vers = vers = svc_getnl(argv); /* version number */
1105 rqstp->rq_proc = proc = svc_getnl(argv); /* procedure number */ 1105 rqstp->rq_proc = proc = svc_getnl(argv); /* procedure number */
1106 1106
1107 progp = serv->sv_program;
1108
1109 for (progp = serv->sv_program; progp; progp = progp->pg_next) 1107 for (progp = serv->sv_program; progp; progp = progp->pg_next)
1110 if (prog == progp->pg_prog) 1108 if (prog == progp->pg_prog)
1111 break; 1109 break;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 17c88928b7db..dd9d295813cf 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -393,8 +393,10 @@ static int xs_send_kvec(struct socket *sock, struct sockaddr *addr, int addrlen,
393 return kernel_sendmsg(sock, &msg, NULL, 0, 0); 393 return kernel_sendmsg(sock, &msg, NULL, 0, 0);
394} 394}
395 395
396static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more) 396static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more, bool zerocopy)
397{ 397{
398 ssize_t (*do_sendpage)(struct socket *sock, struct page *page,
399 int offset, size_t size, int flags);
398 struct page **ppage; 400 struct page **ppage;
399 unsigned int remainder; 401 unsigned int remainder;
400 int err, sent = 0; 402 int err, sent = 0;
@@ -403,6 +405,9 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
403 base += xdr->page_base; 405 base += xdr->page_base;
404 ppage = xdr->pages + (base >> PAGE_SHIFT); 406 ppage = xdr->pages + (base >> PAGE_SHIFT);
405 base &= ~PAGE_MASK; 407 base &= ~PAGE_MASK;
408 do_sendpage = sock->ops->sendpage;
409 if (!zerocopy)
410 do_sendpage = sock_no_sendpage;
406 for(;;) { 411 for(;;) {
407 unsigned int len = min_t(unsigned int, PAGE_SIZE - base, remainder); 412 unsigned int len = min_t(unsigned int, PAGE_SIZE - base, remainder);
408 int flags = XS_SENDMSG_FLAGS; 413 int flags = XS_SENDMSG_FLAGS;
@@ -410,7 +415,7 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
410 remainder -= len; 415 remainder -= len;
411 if (remainder != 0 || more) 416 if (remainder != 0 || more)
412 flags |= MSG_MORE; 417 flags |= MSG_MORE;
413 err = sock->ops->sendpage(sock, *ppage, base, len, flags); 418 err = do_sendpage(sock, *ppage, base, len, flags);
414 if (remainder == 0 || err != len) 419 if (remainder == 0 || err != len)
415 break; 420 break;
416 sent += err; 421 sent += err;
@@ -431,9 +436,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
431 * @addrlen: UDP only -- length of destination address 436 * @addrlen: UDP only -- length of destination address
432 * @xdr: buffer containing this request 437 * @xdr: buffer containing this request
433 * @base: starting position in the buffer 438 * @base: starting position in the buffer
439 * @zerocopy: true if it is safe to use sendpage()
434 * 440 *
435 */ 441 */
436static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base) 442static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base, bool zerocopy)
437{ 443{
438 unsigned int remainder = xdr->len - base; 444 unsigned int remainder = xdr->len - base;
439 int err, sent = 0; 445 int err, sent = 0;
@@ -461,7 +467,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen,
461 if (base < xdr->page_len) { 467 if (base < xdr->page_len) {
462 unsigned int len = xdr->page_len - base; 468 unsigned int len = xdr->page_len - base;
463 remainder -= len; 469 remainder -= len;
464 err = xs_send_pagedata(sock, xdr, base, remainder != 0); 470 err = xs_send_pagedata(sock, xdr, base, remainder != 0, zerocopy);
465 if (remainder == 0 || err != len) 471 if (remainder == 0 || err != len)
466 goto out; 472 goto out;
467 sent += err; 473 sent += err;
@@ -564,7 +570,7 @@ static int xs_local_send_request(struct rpc_task *task)
564 req->rq_svec->iov_base, req->rq_svec->iov_len); 570 req->rq_svec->iov_base, req->rq_svec->iov_len);
565 571
566 status = xs_sendpages(transport->sock, NULL, 0, 572 status = xs_sendpages(transport->sock, NULL, 0,
567 xdr, req->rq_bytes_sent); 573 xdr, req->rq_bytes_sent, true);
568 dprintk("RPC: %s(%u) = %d\n", 574 dprintk("RPC: %s(%u) = %d\n",
569 __func__, xdr->len - req->rq_bytes_sent, status); 575 __func__, xdr->len - req->rq_bytes_sent, status);
570 if (likely(status >= 0)) { 576 if (likely(status >= 0)) {
@@ -620,7 +626,7 @@ static int xs_udp_send_request(struct rpc_task *task)
620 status = xs_sendpages(transport->sock, 626 status = xs_sendpages(transport->sock,
621 xs_addr(xprt), 627 xs_addr(xprt),
622 xprt->addrlen, xdr, 628 xprt->addrlen, xdr,
623 req->rq_bytes_sent); 629 req->rq_bytes_sent, true);
624 630
625 dprintk("RPC: xs_udp_send_request(%u) = %d\n", 631 dprintk("RPC: xs_udp_send_request(%u) = %d\n",
626 xdr->len - req->rq_bytes_sent, status); 632 xdr->len - req->rq_bytes_sent, status);
@@ -693,6 +699,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
693 struct rpc_xprt *xprt = req->rq_xprt; 699 struct rpc_xprt *xprt = req->rq_xprt;
694 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 700 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
695 struct xdr_buf *xdr = &req->rq_snd_buf; 701 struct xdr_buf *xdr = &req->rq_snd_buf;
702 bool zerocopy = true;
696 int status; 703 int status;
697 704
698 xs_encode_stream_record_marker(&req->rq_snd_buf); 705 xs_encode_stream_record_marker(&req->rq_snd_buf);
@@ -700,13 +707,20 @@ static int xs_tcp_send_request(struct rpc_task *task)
700 xs_pktdump("packet data:", 707 xs_pktdump("packet data:",
701 req->rq_svec->iov_base, 708 req->rq_svec->iov_base,
702 req->rq_svec->iov_len); 709 req->rq_svec->iov_len);
710 /* Don't use zero copy if this is a resend. If the RPC call
711 * completes while the socket holds a reference to the pages,
712 * then we may end up resending corrupted data.
713 */
714 if (task->tk_flags & RPC_TASK_SENT)
715 zerocopy = false;
703 716
704 /* Continue transmitting the packet/record. We must be careful 717 /* Continue transmitting the packet/record. We must be careful
705 * to cope with writespace callbacks arriving _after_ we have 718 * to cope with writespace callbacks arriving _after_ we have
706 * called sendmsg(). */ 719 * called sendmsg(). */
707 while (1) { 720 while (1) {
708 status = xs_sendpages(transport->sock, 721 status = xs_sendpages(transport->sock,
709 NULL, 0, xdr, req->rq_bytes_sent); 722 NULL, 0, xdr, req->rq_bytes_sent,
723 zerocopy);
710 724
711 dprintk("RPC: xs_tcp_send_request(%u) = %d\n", 725 dprintk("RPC: xs_tcp_send_request(%u) = %d\n",
712 xdr->len - req->rq_bytes_sent, status); 726 xdr->len - req->rq_bytes_sent, status);
diff --git a/net/vmw_vsock/Kconfig b/net/vmw_vsock/Kconfig
index b5fa7e40cdcb..14810abedc2e 100644
--- a/net/vmw_vsock/Kconfig
+++ b/net/vmw_vsock/Kconfig
@@ -6,7 +6,7 @@ config VSOCKETS
6 tristate "Virtual Socket protocol" 6 tristate "Virtual Socket protocol"
7 help 7 help
8 Virtual Socket Protocol is a socket protocol similar to TCP/IP 8 Virtual Socket Protocol is a socket protocol similar to TCP/IP
9 allowing comunication between Virtual Machines and hypervisor 9 allowing communication between Virtual Machines and hypervisor
10 or host. 10 or host.
11 11
12 You should also select one or more hypervisor-specific transports 12 You should also select one or more hypervisor-specific transports