}
EXPORT_SYMBOL_GPL(get_net_ns_by_pid);
+ #ifdef CONFIG_NET_NS_REFCNT_TRACKER
+ static void net_ns_net_debugfs(struct net *net)
+ {
+ ref_tracker_dir_symlink(&net->refcnt_tracker, "netns-%llx-%u-refcnt",
+ net->net_cookie, net->ns.inum);
+ ref_tracker_dir_symlink(&net->notrefcnt_tracker, "netns-%llx-%u-notrefcnt",
+ net->net_cookie, net->ns.inum);
+ }
+
+ static int __init init_net_debugfs(void)
+ {
+ ref_tracker_dir_debugfs(&init_net.refcnt_tracker);
+ ref_tracker_dir_debugfs(&init_net.notrefcnt_tracker);
+ net_ns_net_debugfs(&init_net);
+ return 0;
+ }
+ late_initcall(init_net_debugfs);
+ #else
+ static void net_ns_net_debugfs(struct net *net)
+ {
+ }
+ #endif
+
static __net_init int net_ns_net_init(struct net *net)
{
- int ret;
-
#ifdef CONFIG_NET_NS
net->ns.ops = &netns_operations;
#endif
- if (net == &init_net) {
- net->ns.inum = PROC_NET_INIT_INO;
- return 0;
- ret = ns_alloc_inum(&net->ns);
- if (!ret)
- net_ns_net_debugfs(net);
- return ret;
++ net->ns.inum = PROC_NET_INIT_INO;
++ if (net != &init_net) {
++ int ret = ns_alloc_inum(&net->ns);
++ if (ret)
++ return ret;
+ }
- return ns_alloc_inum(&net->ns);
++ net_ns_net_debugfs(net);
++ return 0;
}
static __net_exit void net_ns_net_exit(struct net *net)
fds_sent = true;
+ err = unix_maybe_add_creds(skb, sk, other);
+ if (err)
+ goto out_free;
+
if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES)) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
- err = skb_splice_from_iter(skb, &msg->msg_iter, size,
- sk->sk_allocation);
+ err = skb_splice_from_iter(skb, &msg->msg_iter, size);
if (err < 0)
goto out_free;
goto out_free;
}
- unix_maybe_add_creds(skb, sk, other);
scm_stat_add(other, skb);
- skb_queue_tail(&other->sk_receive_queue, skb);
+
+ spin_lock(&other->sk_receive_queue.lock);
+ WRITE_ONCE(otheru->inq_len, otheru->inq_len + skb->len);
+ __skb_queue_tail(&other->sk_receive_queue, skb);
+ spin_unlock(&other->sk_receive_queue.lock);
+
unix_state_unlock(other);
other->sk_data_ready(other);
sent += size;