lkml.org 
[lkml]   [2005]   [Apr]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRE: Isn't there race issue during fput() and the dentry_open()?
DateTue, 5 Apr 2005 13:46:49 +0900
From"Tomita, Haruo" <>
Hi Viro,

Thank you for your help and advice.
I made the following patches referring to your advice. 
I try to debugging by using this patch. 

Thanks again,
Haruo

diff -urN linux-2.6.12-rc2.orig/fs/file_table.c linux-2.6.12-rc2/fs/file_table.c
--- linux-2.6.12-rc2.orig/fs/file_table.c	2005-03-02 16:37:47.000000000 +0900
+++ linux-2.6.12-rc2/fs/file_table.c	2005-04-05 11:21:58.000000000 +0900
@@ -26,6 +26,7 @@
 
 /* public. Not pretty! */
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
+pid_t holder_pid;
 
 static DEFINE_SPINLOCK(filp_count_lock);
 
diff -urN linux-2.6.12-rc2.orig/include/linux/fs.h linux-2.6.12-rc2/include/linux/fs.h
--- linux-2.6.12-rc2.orig/include/linux/fs.h	2005-04-05 11:12:53.000000000 +0900
+++ linux-2.6.12-rc2/include/linux/fs.h	2005-04-05 11:20:15.000000000 +0900
@@ -602,8 +602,17 @@
 	struct address_space	*f_mapping;
 };
 extern spinlock_t files_lock;
-#define file_list_lock() spin_lock(&files_lock);
-#define file_list_unlock() spin_unlock(&files_lock);
+extern pid_t holder_pid;
+#define file_list_lock() \
+	do { \
+		spin_lock(&files_lock); \
+		holder_pid = current->pid; \
+	}while(0)
+#define file_list_unlock() \
+	do { \
+		holder_pid = 0; \
+		spin_unlock(&files_lock); \
+	}while(0)
 
 #define get_file(x)	atomic_inc(&(x)->f_count)
 #define file_count(x)	atomic_read(&(x)->f_count)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-04-06 11:31    [from the cache]
©2003-2008