Skip to contentSkip to conversation

cr: nsproxy: fix refcounting

PATCH Applied Serge E. Hallyn 2 participants 2 messages May 26, 2009 – May 27, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cr: nsproxy: fix refcounting

[This is the fix for the bug I was trying to nail down earlier today]

If more than one restarted task are to share a checkpointed nsproxy, then we must inc the count on the nsproxy for each new task, as switch_task_namespaces() does not do that for us.

---
 checkpoint/process.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
checkpoint/process.c +3 -1
index fa166cd..52d2a9c 100644
@@ -603,8 +603,10 @@ static int restore_ns_obj(struct ckpt_ctx *ctx, int ns_objref)
 	if (IS_ERR(nsproxy))
 		return PTR_ERR(nsproxy);
 
-	if (nsproxy != task_nsproxy(current))
+	if (nsproxy != task_nsproxy(current)) {
+		get_nsproxy(nsproxy);
 		switch_task_namespaces(current, nsproxy);
+	}
 
 	return 0;
 }
Signature · 1 line
1.6.1

A message that is not in the archive (sent off-list or not yet received): 20090526220313.GA18572-r/[email protected]

Applied
#2 lore raw

thanks, applied.

Quoted 27 lines · Serge E. Hallyn

[This is the fix for the bug I was trying to nail down earlier today]

If more than one restarted task are to share a checkpointed nsproxy, then we must inc the count on the nsproxy for each new task, as switch_task_namespaces() does not do that for us.

---
 checkpoint/process.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
checkpoint/process.c +3 -1
index fa166cd..52d2a9c 100644
@@ -603,8 +603,10 @@ static int restore_ns_obj(struct ckpt_ctx *ctx, int ns_objref)
 	if (IS_ERR(nsproxy))
 		return PTR_ERR(nsproxy);
 
-	if (nsproxy != task_nsproxy(current))
+	if (nsproxy != task_nsproxy(current)) {
+		get_nsproxy(nsproxy);
 		switch_task_namespaces(current, nsproxy);
+	}
 
 	return 0;
 }