[Devel] [PATCH 2/5] c/r: nit to avoid rcu lockdep complaint in restore_obj_sighand()

Oren Laadan orenl at cs.columbia.edu
Wed Jan 26 08:10:48 PST 2011


Signed-off-by: Oren Laadan <orenl at cs.columbia.edu>
---
 kernel/signal.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index dca40be..3842f5d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2871,7 +2871,7 @@ static void *restore_sighand(struct ckpt_ctx *ctx)
 int restore_obj_sighand(struct ckpt_ctx *ctx, int sighand_objref)
 {
 	struct sighand_struct *sighand;
-	struct sighand_struct *old_sighand;
+	struct sighand_struct *old_sighand = NULL;
 
 	sighand = ckpt_obj_fetch(ctx, sighand_objref, CKPT_OBJ_SIGHAND);
 	if (IS_ERR(sighand))
@@ -2884,11 +2884,14 @@ int restore_obj_sighand(struct ckpt_ctx *ctx, int sighand_objref)
 
 	/* manipulate tsk->sighand with tasklist lock write-held */
 	write_lock_irq(&tasklist_lock);
-	old_sighand = rcu_dereference(current->sighand);
+	old_sighand = rcu_dereference_check(current->sighand,
+					    rcu_read_lock_held() ||
+					    lockdep_is_held(&tasklist_lock));
 	spin_lock(&old_sighand->siglock);
 	rcu_assign_pointer(current->sighand, sighand);
 	spin_unlock(&old_sighand->siglock);
 	write_unlock_irq(&tasklist_lock);
+
 	__cleanup_sighand(old_sighand);
 
 	return 0;
-- 
1.7.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list