aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorNick Piggin <npiggin@kernel.dk>2011-01-07 01:49:57 -0500
committerNick Piggin <npiggin@kernel.dk>2011-01-07 01:50:29 -0500
commit34286d6662308d82aed891852d04c7c3a2649b16 (patch)
treec4b7311404d302e7cb94df7a4690298e1059910a /fs/proc
parent44a7d7a878c9cbb74f236ea755b25b6b2e26a9a9 (diff)
fs: rcu-walk aware d_revalidate method
Require filesystems be aware of .d_revalidate being called in rcu-walk mode (nd->flags & LOOKUP_RCU). For now do a simple push down, returning -ECHILD from all implementations. Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c33
-rw-r--r--fs/proc/proc_sysctl.c3
2 files changed, 29 insertions, 7 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 85f0a80912aa..dc5b2fcadc3b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1719,10 +1719,16 @@ static int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat
1719 */ 1719 */
1720static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) 1720static int pid_revalidate(struct dentry *dentry, struct nameidata *nd)
1721{ 1721{
1722 struct inode *inode = dentry->d_inode; 1722 struct inode *inode;
1723 struct task_struct *task = get_proc_task(inode); 1723 struct task_struct *task;
1724 const struct cred *cred; 1724 const struct cred *cred;
1725 1725
1726 if (nd && nd->flags & LOOKUP_RCU)
1727 return -ECHILD;
1728
1729 inode = dentry->d_inode;
1730 task = get_proc_task(inode);
1731
1726 if (task) { 1732 if (task) {
1727 if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) || 1733 if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) ||
1728 task_dumpable(task)) { 1734 task_dumpable(task)) {
@@ -1888,12 +1894,19 @@ static int proc_fd_link(struct inode *inode, struct path *path)
1888 1894
1889static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) 1895static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
1890{ 1896{
1891 struct inode *inode = dentry->d_inode; 1897 struct inode *inode;
1892 struct task_struct *task = get_proc_task(inode); 1898 struct task_struct *task;
1893 int fd = proc_fd(inode); 1899 int fd;
1894 struct files_struct *files; 1900 struct files_struct *files;
1895 const struct cred *cred; 1901 const struct cred *cred;
1896 1902
1903 if (nd && nd->flags & LOOKUP_RCU)
1904 return -ECHILD;
1905
1906 inode = dentry->d_inode;
1907 task = get_proc_task(inode);
1908 fd = proc_fd(inode);
1909
1897 if (task) { 1910 if (task) {
1898 files = get_files_struct(task); 1911 files = get_files_struct(task);
1899 if (files) { 1912 if (files) {
@@ -2563,8 +2576,14 @@ static const struct pid_entry proc_base_stuff[] = {
2563 */ 2576 */
2564static int proc_base_revalidate(struct dentry *dentry, struct nameidata *nd) 2577static int proc_base_revalidate(struct dentry *dentry, struct nameidata *nd)
2565{ 2578{
2566 struct inode *inode = dentry->d_inode; 2579 struct inode *inode;
2567 struct task_struct *task = get_proc_task(inode); 2580 struct task_struct *task;
2581
2582 if (nd->flags & LOOKUP_RCU)
2583 return -ECHILD;
2584
2585 inode = dentry->d_inode;
2586 task = get_proc_task(inode);
2568 if (task) { 2587 if (task) {
2569 put_task_struct(task); 2588 put_task_struct(task);
2570 return 1; 2589 return 1;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 35efd85a4d32..c9097f43b425 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -5,6 +5,7 @@
5#include <linux/sysctl.h> 5#include <linux/sysctl.h>
6#include <linux/proc_fs.h> 6#include <linux/proc_fs.h>
7#include <linux/security.h> 7#include <linux/security.h>
8#include <linux/namei.h>
8#include "internal.h" 9#include "internal.h"
9 10
10static const struct dentry_operations proc_sys_dentry_operations; 11static const struct dentry_operations proc_sys_dentry_operations;
@@ -389,6 +390,8 @@ static const struct inode_operations proc_sys_dir_operations = {
389 390
390static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd) 391static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd)
391{ 392{
393 if (nd->flags & LOOKUP_RCU)
394 return -ECHILD;
392 return !PROC_I(dentry->d_inode)->sysctl->unregistering; 395 return !PROC_I(dentry->d_inode)->sysctl->unregistering;
393} 396}
394 397