DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create()
@ 2015-06-15  4:07 Wenfeng Liu
  2015-06-17  3:58 ` Zhang, Helin
  2015-06-17  5:51 ` Zhang, Helin
  0 siblings, 2 replies; 6+ messages in thread
From: Wenfeng Liu @ 2015-06-15  4:07 UTC (permalink / raw)
  To: helin.zhang, dev

In containers like docker, current->pid returns current process's global PID instead of its
own PID under containers's PID namespace, and get_net_ns_by_pid() suppose to accept a virtual
PID under its own namespace, so we should use task_pid_vnr(current) to get current process's
virtual PID instead of current->pid.

Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 1935d32..18fb677 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long ioctl_param)
 		return -EBUSY;
 	}
 
-	net = get_net_ns_by_pid(current->pid);
+	net = get_net_ns_by_pid(task_pid_vnr(current));
 	if (IS_ERR(net)) {
 		free_netdev(net_dev);
 		return PTR_ERR(net);
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create()
  2015-06-15  4:07 [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create() Wenfeng Liu
@ 2015-06-17  3:58 ` Zhang, Helin
  2015-06-17  5:43   ` [dpdk-dev] 答复: " Wenfeng Liu
  2015-06-17  5:51 ` Zhang, Helin
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang, Helin @ 2015-06-17  3:58 UTC (permalink / raw)
  To: Wenfeng Liu; +Cc: dev



> -----Original Message-----
> From: Wenfeng Liu [mailto:liuwf@arraynetworks.com.cn]
> Sent: Monday, June 15, 2015 12:08 PM
> To: Zhang, Helin; dev@dpdk.org
> Subject: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in
> kni_ioctl_create()
> 
> In containers like docker, current->pid returns current process's global PID
> instead of its own PID under containers's PID namespace, and
> get_net_ns_by_pid() suppose to accept a virtual PID under its own namespace,
> so we should use task_pid_vnr(current) to get current process's virtual PID
> instead of current->pid.
> 
> Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
> ---
>  lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c
> b/lib/librte_eal/linuxapp/kni/kni_misc.c
> index 1935d32..18fb677 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> @@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned long
> ioctl_param)
>  		return -EBUSY;
>  	}
> 
> -	net = get_net_ns_by_pid(current->pid);
> +	net = get_net_ns_by_pid(task_pid_vnr(current));
Have you tried it on a very old kernel versions? E.g. 2.6.33

Helin

>  	if (IS_ERR(net)) {
>  		free_netdev(net_dev);
>  		return PTR_ERR(net);
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] 答复: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create()
  2015-06-17  3:58 ` Zhang, Helin
@ 2015-06-17  5:43   ` Wenfeng Liu
  2015-06-17  5:49     ` [dpdk-dev] " Zhang, Helin
  0 siblings, 1 reply; 6+ messages in thread
From: Wenfeng Liu @ 2015-06-17  5:43 UTC (permalink / raw)
  To: 'Zhang, Helin'; +Cc: dev

Hi Helin,

Since I don’t have any 2.6.33 machine on hand right now, I tried to compile
this patch on 2.6.32, and it succeed.
I can't verify this modification in docker since it only support Linux
kernel >= 3.10. 

Thanks,
liuwf

-----邮件原件-----
发件人: Zhang, Helin [mailto:helin.zhang@intel.com] 
发送时间: 2015年6月17日 11:59
收件人: Wenfeng Liu
抄送: dev@dpdk.org
主题: RE: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid()
in kni_ioctl_create()



> -----Original Message-----
> From: Wenfeng Liu [mailto:liuwf@arraynetworks.com.cn]
> Sent: Monday, June 15, 2015 12:08 PM
> To: Zhang, Helin; dev@dpdk.org
> Subject: [PATCH] kni: Passing task_pid_vnr(current) to 
> get_net_ns_by_pid() in
> kni_ioctl_create()
> 
> In containers like docker, current->pid returns current process's 
> global PID instead of its own PID under containers's PID namespace, 
> and
> get_net_ns_by_pid() suppose to accept a virtual PID under its own 
> namespace, so we should use task_pid_vnr(current) to get current 
> process's virtual PID instead of current->pid.
> 
> Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
> ---
>  lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c
> b/lib/librte_eal/linuxapp/kni/kni_misc.c
> index 1935d32..18fb677 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> @@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned 
> long
> ioctl_param)
>  		return -EBUSY;
>  	}
> 
> -	net = get_net_ns_by_pid(current->pid);
> +	net = get_net_ns_by_pid(task_pid_vnr(current));
Have you tried it on a very old kernel versions? E.g. 2.6.33

Helin

>  	if (IS_ERR(net)) {
>  		free_netdev(net_dev);
>  		return PTR_ERR(net);
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create()
  2015-06-17  5:43   ` [dpdk-dev] 答复: " Wenfeng Liu
@ 2015-06-17  5:49     ` Zhang, Helin
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang, Helin @ 2015-06-17  5:49 UTC (permalink / raw)
  To: Wenfeng Liu; +Cc: dev



> -----Original Message-----
> From: Wenfeng Liu [mailto:liuwf@arraynetworks.com.cn]
> Sent: Wednesday, June 17, 2015 1:44 PM
> To: Zhang, Helin
> Cc: dev@dpdk.org
> Subject: 答复: [PATCH] kni: Passing task_pid_vnr(current) to
> get_net_ns_by_pid() in kni_ioctl_create()
> 
> Hi Helin,
> 
> Since I don’t have any 2.6.33 machine on hand right now, I tried to compile this
> patch on 2.6.32, and it succeed.
> I can't verify this modification in docker since it only support Linux kernel >= 3.10.
OK, I think it should be enough. Thanks!

- Helin

> 
> Thanks,
> liuwf
> 
> -----邮件原件-----
> 发件人: Zhang, Helin [mailto:helin.zhang@intel.com]
> 发送时间: 2015年6月17日 11:59
> 收件人: Wenfeng Liu
> 抄送: dev@dpdk.org
> 主题: RE: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in
> kni_ioctl_create()
> 
> 
> 
> > -----Original Message-----
> > From: Wenfeng Liu [mailto:liuwf@arraynetworks.com.cn]
> > Sent: Monday, June 15, 2015 12:08 PM
> > To: Zhang, Helin; dev@dpdk.org
> > Subject: [PATCH] kni: Passing task_pid_vnr(current) to
> > get_net_ns_by_pid() in
> > kni_ioctl_create()
> >
> > In containers like docker, current->pid returns current process's
> > global PID instead of its own PID under containers's PID namespace,
> > and
> > get_net_ns_by_pid() suppose to accept a virtual PID under its own
> > namespace, so we should use task_pid_vnr(current) to get current
> > process's virtual PID instead of current->pid.
> >
> > Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
> > ---
> >  lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c
> > b/lib/librte_eal/linuxapp/kni/kni_misc.c
> > index 1935d32..18fb677 100644
> > --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> > +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> > @@ -359,7 +359,7 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned
> > long
> > ioctl_param)
> >  		return -EBUSY;
> >  	}
> >
> > -	net = get_net_ns_by_pid(current->pid);
> > +	net = get_net_ns_by_pid(task_pid_vnr(current));
> Have you tried it on a very old kernel versions? E.g. 2.6.33
> 
> Helin
> 
> >  	if (IS_ERR(net)) {
> >  		free_netdev(net_dev);
> >  		return PTR_ERR(net);
> > --
> > 1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create()
  2015-06-15  4:07 [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create() Wenfeng Liu
  2015-06-17  3:58 ` Zhang, Helin
@ 2015-06-17  5:51 ` Zhang, Helin
  2015-06-17 13:08   ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Zhang, Helin @ 2015-06-17  5:51 UTC (permalink / raw)
  To: Wenfeng Liu; +Cc: dev



> -----Original Message-----
> From: Wenfeng Liu [mailto:liuwf@arraynetworks.com.cn]
> Sent: Monday, June 15, 2015 12:08 PM
> To: Zhang, Helin; dev@dpdk.org
> Subject: [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in
> kni_ioctl_create()
> 
> In containers like docker, current->pid returns current process's global PID
> instead of its own PID under containers's PID namespace, and
> get_net_ns_by_pid() suppose to accept a virtual PID under its own namespace,
> so we should use task_pid_vnr(current) to get current process's virtual PID
> instead of current->pid.
> 
> Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
Acked-by: Helin Zhang <helin.zhang@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create()
  2015-06-17  5:51 ` Zhang, Helin
@ 2015-06-17 13:08   ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-06-17 13:08 UTC (permalink / raw)
  To: Wenfeng Liu; +Cc: dev

> > In containers like docker, current->pid returns current process's global PID
> > instead of its own PID under containers's PID namespace, and
> > get_net_ns_by_pid() suppose to accept a virtual PID under its own namespace,
> > so we should use task_pid_vnr(current) to get current process's virtual PID
> > instead of current->pid.
> > 
> > Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
> Acked-by: Helin Zhang <helin.zhang@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-17 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15  4:07 [dpdk-dev] [PATCH] kni: Passing task_pid_vnr(current) to get_net_ns_by_pid() in kni_ioctl_create() Wenfeng Liu
2015-06-17  3:58 ` Zhang, Helin
2015-06-17  5:43   ` [dpdk-dev] 答复: " Wenfeng Liu
2015-06-17  5:49     ` [dpdk-dev] " Zhang, Helin
2015-06-17  5:51 ` Zhang, Helin
2015-06-17 13:08   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).