OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Update get_net_ns_by_pid
[PATCH] Update get_net_ns_by_pid [message #20927] Fri, 28 September 2007 03:48 Go to next message
ebiederm is currently offline  ebiederm
Messages: 1354
Registered: February 2006
Senior Member
In the -mm tree the rules for access an nsproxy have changed,
and in get_net_ns_by_pid we access the nsproxy, so update
it to follow the new rules.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 739fbad..1caba10 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -746,10 +746,10 @@ static struct net *get_net_ns_by_pid(pid_t pid)
 	rcu_read_lock();
 	tsk = find_task_by_pid(pid);
 	if (tsk) {
-		task_lock(tsk);
-		if (tsk->nsproxy)
-			net = get_net(tsk->nsproxy->net_ns);
-		task_unlock(tsk);
+		struct nsproxy *nsproxy;
+		nsproxy = task_nsproxy(tsk);
+		if (nsproxy)
+			net = get_net(nsproxy->net_ns);
 	}
 	rcu_read_unlock();
 	return net;
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH] Update get_net_ns_by_pid [message #20978 is a reply to message #20927] Fri, 28 September 2007 23:13 Go to previous message
serue is currently offline  serue
Messages: 750
Registered: February 2006
Senior Member
Quoting Eric W. Biederman (ebiederm@xmission.com):
> 
> In the -mm tree the rules for access an nsproxy have changed,
> and in get_net_ns_by_pid we access the nsproxy, so update
> it to follow the new rules.
> 
> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

Yup, looks right.

I assume Pavel's Acked-by would actually matter, but still

Acked-by: Serge Hallyn <serue@us.ibm.com>

thanks,
-serge

> ---
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 739fbad..1caba10 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -746,10 +746,10 @@ static struct net *get_net_ns_by_pid(pid_t pid)
>  	rcu_read_lock();
>  	tsk = find_task_by_pid(pid);
>  	if (tsk) {
> -		task_lock(tsk);
> -		if (tsk->nsproxy)
> -			net = get_net(tsk->nsproxy->net_ns);
> -		task_unlock(tsk);
> +		struct nsproxy *nsproxy;
> +		nsproxy = task_nsproxy(tsk);
> +		if (nsproxy)
> +			net = get_net(nsproxy->net_ns);
>  	}
>  	rcu_read_unlock();
>  	return net;
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [PATCH] capabilities: introduce per-process capability bounding set (v2)
Next Topic: [PATCH 00/29] Rename Containers to Control Groups
Goto Forum:
  


Current Time: Tue Aug 19 15:00:34 GMT 2025

Total time taken to generate the page: 0.12788 seconds