Skip to contentSkip to conversation

c/r: make ckpt_debug() safe if called by dead tasks

PATCH In review Oren Laadan 2 participants 2 messages Sep 24, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 c/r: make ckpt_debug() safe if called by dead tasks

From: Oren Laadan <[email protected]>

One may not call task_pid_vnr() on dead tasks because they don't have a valid ->nxproxy pointer. However, the ckpt_ctx cleanup may be called by a dead task from do_exit(), in the case of zombie or "ghost" tasks.

This patch makes ckpt_debug() safe to call from dead tasks context, so that debug printing from code called by ckpt_ctx_free() is cool.

---
 include/linux/checkpoint.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/checkpoint.h +3 -1
index e00dd70..5294a96 100644
@@ -334,7 +334,9 @@ extern unsigned long ckpt_debug_level;
 	do {								\
 		if (ckpt_debug_level & (level))				\
 			printk(KERN_DEBUG "[%d:%d:c/r:%s:%d] " fmt,	\
-				current->pid, task_pid_vnr(current),	\
+				current->pid,				\
+				current->nsproxy ?			\
+				task_pid_vnr(current) : -1,		\
 				__func__, __LINE__, ## args);		\
 	} while (0)
 
Signature · 1 line
1.6.0.4

A message that is not in the archive (sent off-list or not yet received): 1253826292-23452-1-git-send-email-orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org

#2 lore raw
Quoted 10 lines · Oren Laadan

From: Oren Laadan <[email protected]>

One may not call task_pid_vnr() on dead tasks because they don't have a valid ->nxproxy pointer. However, the ckpt_ctx cleanup may be called by a dead task from do_exit(), in the case of zombie or "ghost" tasks.

This patch makes ckpt_debug() safe to call from dead tasks context, so that debug printing from code called by ckpt_ctx_free() is cool.

thanks,
-serge

Quoted 26 lines
---
 include/linux/checkpoint.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/checkpoint.h +3 -1
index e00dd70..5294a96 100644
@@ -334,7 +334,9 @@ extern unsigned long ckpt_debug_level;
 	do {								\
 		if (ckpt_debug_level & (level))				\
 			printk(KERN_DEBUG "[%d:%d:c/r:%s:%d] " fmt,	\
-				current->pid, task_pid_vnr(current),	\
+				current->pid,				\
+				current->nsproxy ?			\
+				task_pid_vnr(current) : -1,		\
 				__func__, __LINE__, ## args);		\
 	} while (0)
 
Signature · 6 lines
1.6.0.4

_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers