[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <12626570514009-git-send-email->
Date: Mon, 4 Jan 2010 18:04:09 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: mingo@...e.hu, laijs@...fujitsu.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...ymtl.ca,
josh@...htriplett.org, dvhltc@...ibm.com, niv@...ibm.com,
tglx@...utronix.de, peterz@...radead.org, rostedt@...dmis.org,
Valdis.Kletnieks@...edu, dhowells@...hat.com,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: [PATCH tip/core/rcu 6/8] vfs: apply lockdep-based checking to rcu_dereference() uses
From: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Add lockdep-ified RCU primitives to alloc_fd(), files_fdtable() and
fcheck_files().
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
---
fs/file.c | 2 +-
include/linux/fdtable.h | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/file.c b/fs/file.c
index f313314..c506bc6 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -477,7 +477,7 @@ repeat:
error = fd;
#if 1
/* Sanity check */
- if (rcu_dereference(fdt->fd[fd]) != NULL) {
+ if (rcu_dereference_raw(fdt->fd[fd]) != NULL) {
printk(KERN_WARNING "alloc_fd: slot %d not NULL!\n", fd);
rcu_assign_pointer(fdt->fd[fd], NULL);
}
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index a2ec74b..e498a0c 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -57,7 +57,10 @@ struct files_struct {
struct file * fd_array[NR_OPEN_DEFAULT];
};
-#define files_fdtable(files) (rcu_dereference((files)->fdt))
+#define files_fdtable(files) \
+ (rcu_dereference_check((files)->fdt, \
+ rcu_read_lock_held() || \
+ lockdep_is_held(&(files)->file_lock)))
struct file_operations;
struct vfsmount;
@@ -78,7 +81,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
struct fdtable *fdt = files_fdtable(files);
if (fd < fdt->max_fds)
- file = rcu_dereference(fdt->fd[fd]);
+ file = rcu_dereference_check(fdt->fd[fd], rcu_read_lock_held() || lockdep_is_held(&files->file_lock));
return file;
}
--
1.5.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists