diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-02-22 17:04:52 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-25 10:34:48 +0100 |
commit | 7dc52157982ab771f40e3c0b7dc55b954c3c2d19 (patch) | |
tree | a41e39174d9535f0c678eb36249ceee4a1775d6b /include/linux/fdtable.h | |
parent | 497f0ab39cd25bed317b29482c147c967f7ecd1f (diff) | |
download | blackbird-op-linux-7dc52157982ab771f40e3c0b7dc55b954c3c2d19.tar.gz blackbird-op-linux-7dc52157982ab771f40e3c0b7dc55b954c3c2d19.zip |
vfs: Apply lockdep-based checking to rcu_dereference() uses
Add lockdep-ified RCU primitives to alloc_fd(), files_fdtable()
and fcheck_files().
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
LKML-Reference: <1266887105-1528-8-git-send-email-paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/fdtable.h')
-rw-r--r-- | include/linux/fdtable.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index a2ec74bc4812..144412ffaced 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -57,7 +57,11 @@ 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) || \ + atomic_read(&files->count) == 1)) struct file_operations; struct vfsmount; @@ -78,7 +82,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) || atomic_read(&files->count) == 1); return file; } |