aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-02-22 20:04:52 -0500
committerIngo Molnar <mingo@elte.hu>2010-02-25 04:34:48 -0500
commit7dc52157982ab771f40e3c0b7dc55b954c3c2d19 (patch)
treea41e39174d9535f0c678eb36249ceee4a1775d6b /include
parent497f0ab39cd25bed317b29482c147c967f7ecd1f (diff)
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')
-rw-r--r--include/linux/fdtable.h8
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 {
57 struct file * fd_array[NR_OPEN_DEFAULT]; 57 struct file * fd_array[NR_OPEN_DEFAULT];
58}; 58};
59 59
60#define files_fdtable(files) (rcu_dereference((files)->fdt)) 60#define files_fdtable(files) \
61 (rcu_dereference_check((files)->fdt, \
62 rcu_read_lock_held() || \
63 lockdep_is_held(&(files)->file_lock) || \
64 atomic_read(&files->count) == 1))
61 65
62struct file_operations; 66struct file_operations;
63struct vfsmount; 67struct vfsmount;
@@ -78,7 +82,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
78 struct fdtable *fdt = files_fdtable(files); 82 struct fdtable *fdt = files_fdtable(files);
79 83
80 if (fd < fdt->max_fds) 84 if (fd < fdt->max_fds)
81 file = rcu_dereference(fdt->fd[fd]); 85 file = rcu_dereference_check(fdt->fd[fd], rcu_read_lock_held() || lockdep_is_held(&files->file_lock) || atomic_read(&files->count) == 1);
82 return file; 86 return file;
83} 87}
84 88