Aaron, any caller thread just binds it to netns on calling enter_netns, once it 
has entered netns, it won't disappear, so exit_netns caller thread must be 
current thread, once it exits netns, it returns back to original root netns, at 
this point, this thread can disappear, not a question, isn't it? So I'm not 
sure why you're saying it is unsafe.

It is impossible to let Linux kernel  provide that API with netns as argument, 
although it is possible to do it theoretically, it is impractical  fantasy IMO 
:-)

-----邮件原件-----
发件人: dev [mailto:[email protected]] 代表 Aaron Conole
发送时间: 2020年9月17日 0:38
收件人: [email protected]
抄送: [email protected]; [email protected]; [email protected]
主题: Re: [ovs-dev] [PATCH v2 0/3] userspace: enable tap interface statistics and 
status update support

[email protected] writes:

> From: Yi Yang <[email protected]>
>
> OVS userspace datapath can't support tap interface statistics and 
> status update, so users can't get these information by cmd "ovs-vsctl 
> list interface tap1", the root cause of this issue is OVS doesn't know 
> network namespace of tap interface.
>
> This patch series fixed this issue and make sure tap interface can 
> show statistics and get status update.
>
> Yi Yang (3):
>   Add netns option for tap interface in userspace datapath
>   Fix tap interface statistics issue
>   Fix tap interface status update issue in network namespace
>
>  lib/dpif-netlink.c         |  51 +++++
>  lib/dpif-netlink.h         |   3 +
>  lib/netdev-linux-private.h |   1 +
>  lib/netdev-linux.c         | 481 
> ++++++++++++++++++++++++++++++++++++++++-----
>  lib/netlink-socket.c       | 146 ++++++++++++++
>  lib/netlink-socket.h       |   2 +
>  lib/socket-util-unix.c     |  37 ++++
>  lib/socket-util.h          |   3 +
>  8 files changed, 675 insertions(+), 49 deletions(-)
>
> --
>
> Changelog
>
>   v1 -> v2:
>     * Split pmd thread support to seperate patch series
>     * Check enter_netns return error
>     * Limit setns to network namespace only by CLONE_NEWNET

Sorry, but more thinking about this I don't support this series going in.  It 
reassociates the thread with a netns that may disappear causing faults in the 
middle of processing - I don't think it's safe.

NAK.

I think the correct solution is to add support in the kernel for getting the 
netns/ifindex from the tap socket, and then use that to query the statistics.  
This should be solved by using (or creating if one doesn't
exist) a kernel API to do this query by getting the netns information and using 
that to do these get operations.

Maybe someone disagrees.

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to