[Devel] [PATCH] c/r: fix lockdep complaint in restore_obj_files()

Oren Laadan orenl at cs.columbia.edu
Mon Mar 15 14:04:30 PDT 2010


"""
  ... the pthread1 test triggers a lockdep warning
  "BUG: spinlock wrong CPU on CPU#4, pthread1/25906"
  ...
"""

(Reported by Nathan Lynch)

This patch moves put_files_struct() outside the spinlock.

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

diff --git a/checkpoint/files.c b/checkpoint/files.c
index 2859cf9..55c5eb3 100644
--- a/checkpoint/files.c
+++ b/checkpoint/files.c
@@ -921,11 +921,15 @@ int restore_obj_file_table(struct ckpt_ctx *ctx, int files_objref)
 		return PTR_ERR(files);
 
 	if (files != current->files) {
+		struct files_struct *prev;
+
 		task_lock(current);
-		put_files_struct(current->files);
+		prev = current->files;
 		current->files = files;
-		task_unlock(current);
 		atomic_inc(&files->count);
+		task_unlock(current);
+
+		put_files_struct(prev);
 	}
 
 	return 0;
-- 
1.6.3.3

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




More information about the Devel mailing list