Skip to contentSkip to conversation

netlink: use the appropriate namespace pid

PATCH In review Tom Goff 3 participants 12 messages Mar 20, 2010 – Apr 2, 2010

Subsystems (3)
lore
Share & tools
lore

Tom Goff

author
#0 lore raw

PATCH 1/1 netlink: use the appropriate namespace pid

This was included in OpenVZ kernels but wasn't integrated upstream.

Quoted 1 line

From git://git.openvz.org/pub/linux-2.6.24-openvz:

	commit 5c69402f18adf7276352e051ece2cf31feefab02
	Author: Alexey Dobriyan <[email protected]>
	Date:   Mon Dec 24 14:37:45 2007 +0300

	    netlink: fixup ->tgid to work in multiple PID namespaces
---
 net/netlink/af_netlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netlink/af_netlink.c +1 -1
index 320d042..b5ac0cd 100644
@@ -545,7 +545,7 @@ static int netlink_autobind(struct socket *sock)
 	struct hlist_head *head;
 	struct sock *osk;
 	struct hlist_node *node;
-	s32 pid = current->tgid;
+	s32 pid = task_tgid_vnr(current);
 	int err;
 	static s32 rover = -4097;
 
Signature · 1 line
1.6.3.3
maintainer
#1 lore raw

From: Tom Goff <[email protected]>
Date: Fri, 19 Mar 2010 18:38:50 -0700

Quoted 10 lines

This was included in OpenVZ kernels but wasn't integrated upstream.

Quoted 1 line

From git://git.openvz.org/pub/linux-2.6.24-openvz:

	commit 5c69402f18adf7276352e051ece2cf31feefab02
	Author: Alexey Dobriyan <[email protected]>
	Date:   Mon Dec 24 14:37:45 2007 +0300

	    netlink: fixup ->tgid to work in multiple PID namespaces

Well, at least CC: the person whose patches your pushing around, maybe they had a reason to not include it? The openvz guys have been extremely good about submitting their stuff so they deserve the benefit of the doubt.

Alexey, can you review Tom's namespace patches in this set?

Thanks!

#2 lore raw
Quoted 14 lines · David Miller

From: Tom Goff <[email protected]>
Date: Fri, 19 Mar 2010 18:38:50 -0700

Quoted 10 lines

This was included in OpenVZ kernels but wasn't integrated upstream.

Quoted 1 line

From git://git.openvz.org/pub/linux-2.6.24-openvz:

      commit 5c69402f18adf7276352e051ece2cf31feefab02
      Author: Alexey Dobriyan <[email protected]>
      Date:   Mon Dec 24 14:37:45 2007 +0300

          netlink: fixup ->tgid to work in multiple PID namespaces

Quoted 7 lines

Well, at least CC: the person whose patches your pushing around, maybe they had a reason to not include it?  The openvz guys have been extremely good about submitting their stuff so they deserve the benefit of the doubt.

Alexey, can you review Tom's namespace patches in this set?

ACK tgid patch, should have sent it myself long ago.

#3 lore raw
Quoted 2 lines
Quoted 2 lines

Alexey, can you review Tom's namespace patches in this set?

re netns sched patch:

* in psched_open() PDE(inode)->data isn't needed because it isn't used -- just pass NULL.
* drop useless trailing return; in psched_net_exit() :^)
* sch_mirred.c still won't work in netns

maintainer
#4 lore raw

From: Alexey Dobriyan <[email protected]>
Date: Wed, 24 Mar 2010 10:19:37 +0200

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines

Alexey, can you review Tom's namespace patches in this set?

re netns sched patch:

* in psched_open() PDE(inode)->data isn't needed because it isn't used -- just pass NULL.
* drop useless trailing return; in psched_net_exit() :^)
* sch_mirred.c still won't work in netns

Tom, please send a patch to fixup these issues.

Thanks.

#5 lore raw

From: David Miller <mailto:[email protected]>
Sent: Friday, March 26, 2010 8:14 PM

Quoted 8 lines
Quoted 6 lines

re netns sched patch:

* in psched_open() PDE(inode)->data isn't needed because it isn't used -- just pass NULL.
* drop useless trailing return; in psched_net_exit() :^)
* sch_mirred.c still won't work in netns

Tom, please send a patch to fixup these issues.

Sorry for the delayed response. A patch I'll send separately addresses the first two comments. The act_mirred.c issue is a little more involved and I'll try to submit a preliminary patch and request comments later this week.

Tom

author
#6 lore raw

PATCH 1/1 net_sched: minor netns related cleanup

In reply to David Miller

These changes were suggested by Alexey Dobriyan <[email protected]>:

- psched_show() does not use any private data so just pass NULL to psched_open()

- remove unnecessary return statement

---
 net/sched/sch_api.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
net/sched/sch_api.c +1 -3
index 6d6fe16..c65866d 100644
@@ -1683,7 +1683,7 @@ static int psched_show(struct seq_file *seq, void *v)
 
 static int psched_open(struct inode *inode, struct file *file)
 {
-	return single_open(file, psched_show, PDE(inode)->data);
+	return single_open(file, psched_show, NULL);
 }
 
 static const struct file_operations psched_fops = {
@@ -1708,8 +1708,6 @@ static int __net_init psched_net_init(struct net *net)
 static void __net_exit psched_net_exit(struct net *net)
 {
 	proc_net_remove(net, "psched");
-
-	return;
 }
 #else
 static int __net_init psched_net_init(struct net *net)
Signature · 1 line
1.6.3.3
maintainer Applied
#7 lore raw

Re: [PATCH] net_sched: minor netns related cleanup

From: Tom Goff <[email protected]>
Date: Tue, 30 Mar 2010 19:43:54 -0700

Quoted 8 lines

These changes were suggested by Alexey Dobriyan <[email protected]>:

- psched_show() does not use any private data so just pass NULL to psched_open()

- remove unnecessary return statement

Applied, thanks.

#9 lore raw
In reply to Alexey Dobriyan
Quoted 1 line · Alexey Dobriyan

ACK tgid patch, should have sent it myself long ago.

Thanks for reviewing this.

David is correct that pid is arbitrary here anyway so it really shouldn't matter. The patch just lets applications that make an incorrect assumption that happens to usually be right for the initial namespace work similarly in other namespaces. So including the patch seems more of a policy question.

Tom

maintainer
#10 lore raw

From: "Goff, Thomas" <[email protected]>
Date: Wed, 24 Mar 2010 07:18:12 -0700

Quoted 10 lines · Alexey Dobriyan
Quoted 1 line

ACK tgid patch, should have sent it myself long ago.

Thanks for reviewing this.

David is correct that pid is arbitrary here anyway so it really shouldn't matter. The patch just lets applications that make an incorrect assumption that happens to usually be right for the initial namespace work similarly in other namespaces. So including the patch seems more of a policy question.

I ended up applying this to net-next-2.6, it's not critical so it's not net-2.6 material, but it's harmless so we can still queue it up for the next merge window.

maintainer
#11 lore raw
In reply to Tom Goff

From: Tom Goff <[email protected]>
Date: Fri, 19 Mar 2010 18:38:50 -0700

Quoted 10 lines

This was included in OpenVZ kernels but wasn't integrated upstream.

Quoted 1 line

From git://git.openvz.org/pub/linux-2.6.24-openvz:

	commit 5c69402f18adf7276352e051ece2cf31feefab02
	Author: Alexey Dobriyan <[email protected]>
	Date:   Mon Dec 24 14:37:45 2007 +0300

	    netlink: fixup ->tgid to work in multiple PID namespaces

BTW, we're ok without this.

The 'pid' in this code is just an arbitrary port number. We are merely using the tgid to seed the port allocator, so it doesn't have to be the real proper tgid.

I'm therefore dropping this for now. If Alexey can show why we might need this, we can revisit the patch.