aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-06-10 16:03:43 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:34:14 -0400
commit0b728e1911cbe6e24020727c3870628b9653f32a (patch)
treecd975921b28300d62f3aca2fc37eef28af89b959
parentfa3c56bbda6c2ac2a57d96ba501dbe85cccd312b (diff)
stop passing nameidata * to ->d_revalidate()
Just the lookup flags. Die, bastard, die... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/porting5
-rw-r--r--Documentation/filesystems/vfs.txt8
-rw-r--r--fs/9p/vfs_dentry.c4
-rw-r--r--fs/afs/dir.c6
-rw-r--r--fs/ceph/dir.c6
-rw-r--r--fs/cifs/dir.c8
-rw-r--r--fs/coda/dir.c6
-rw-r--r--fs/ecryptfs/dentry.c20
-rw-r--r--fs/fat/namei_vfat.c12
-rw-r--r--fs/fuse/dir.c4
-rw-r--r--fs/gfs2/dentry.c6
-rw-r--r--fs/hfs/sysdep.c4
-rw-r--r--fs/jfs/namei.c6
-rw-r--r--fs/namei.c2
-rw-r--r--fs/ncpfs/dir.c6
-rw-r--r--fs/nfs/dir.c10
-rw-r--r--fs/ocfs2/dcache.c5
-rw-r--r--fs/proc/base.c22
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/namespaces.c2
-rw-r--r--fs/proc/proc_sysctl.c4
-rw-r--r--fs/reiserfs/xattr.c2
-rw-r--r--fs/sysfs/dir.c4
-rw-r--r--include/linux/dcache.h2
25 files changed, 74 insertions, 84 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 33e5243948f0..52a057367f6f 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -9,7 +9,7 @@ be able to use diff(1).
9 9
10--------------------------- dentry_operations -------------------------- 10--------------------------- dentry_operations --------------------------
11prototypes: 11prototypes:
12 int (*d_revalidate)(struct dentry *, struct nameidata *); 12 int (*d_revalidate)(struct dentry *, unsigned int);
13 int (*d_hash)(const struct dentry *, const struct inode *, 13 int (*d_hash)(const struct dentry *, const struct inode *,
14 struct qstr *); 14 struct qstr *);
15 int (*d_compare)(const struct dentry *, const struct inode *, 15 int (*d_compare)(const struct dentry *, const struct inode *,
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index ed9fbc23ece0..56750b714d1e 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -431,3 +431,8 @@ release it yourself.
431 d_alloc_root() is gone, along with a lot of bugs caused by code 431 d_alloc_root() is gone, along with a lot of bugs caused by code
432misusing it. Replacement: d_make_root(inode). The difference is, 432misusing it. Replacement: d_make_root(inode). The difference is,
433d_make_root() drops the reference to inode if dentry allocation fails. 433d_make_root() drops the reference to inode if dentry allocation fails.
434
435--
436[mandatory]
437 The witch is dead! Well, 1/3 of it, anyway. ->d_revalidate() does *not*
438take struct nameidata anymore; just the flags.
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 279de2190365..b9a406b2ed0f 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -902,7 +902,7 @@ the VFS uses a default. As of kernel 2.6.22, the following members are
902defined: 902defined:
903 903
904struct dentry_operations { 904struct dentry_operations {
905 int (*d_revalidate)(struct dentry *, struct nameidata *); 905 int (*d_revalidate)(struct dentry *, unsigned int);
906 int (*d_hash)(const struct dentry *, const struct inode *, 906 int (*d_hash)(const struct dentry *, const struct inode *,
907 struct qstr *); 907 struct qstr *);
908 int (*d_compare)(const struct dentry *, const struct inode *, 908 int (*d_compare)(const struct dentry *, const struct inode *,
@@ -921,11 +921,11 @@ struct dentry_operations {
921 dcache. Most filesystems leave this as NULL, because all their 921 dcache. Most filesystems leave this as NULL, because all their
922 dentries in the dcache are valid 922 dentries in the dcache are valid
923 923
924 d_revalidate may be called in rcu-walk mode (nd->flags & LOOKUP_RCU). 924 d_revalidate may be called in rcu-walk mode (flags & LOOKUP_RCU).
925 If in rcu-walk mode, the filesystem must revalidate the dentry without 925 If in rcu-walk mode, the filesystem must revalidate the dentry without
926 blocking or storing to the dentry, d_parent and d_inode should not be 926 blocking or storing to the dentry, d_parent and d_inode should not be
927 used without care (because they can go NULL), instead nd->inode should 927 used without care (because they can change and, in d_inode case, even
928 be used. 928 become NULL under us).
929 929
930 If a situation is encountered that rcu-walk cannot handle, return 930 If a situation is encountered that rcu-walk cannot handle, return
931 -ECHILD and it will be called again in ref-walk mode. 931 -ECHILD and it will be called again in ref-walk mode.
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index d529437ff442..64600b5d0522 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -100,13 +100,13 @@ static void v9fs_dentry_release(struct dentry *dentry)
100 } 100 }
101} 101}
102 102
103static int v9fs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd) 103static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
104{ 104{
105 struct p9_fid *fid; 105 struct p9_fid *fid;
106 struct inode *inode; 106 struct inode *inode;
107 struct v9fs_inode *v9inode; 107 struct v9fs_inode *v9inode;
108 108
109 if (nd->flags & LOOKUP_RCU) 109 if (flags & LOOKUP_RCU)
110 return -ECHILD; 110 return -ECHILD;
111 111
112 inode = dentry->d_inode; 112 inode = dentry->d_inode;
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index e22dc4b4a503..65c54ab04733 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -23,7 +23,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
23 struct nameidata *nd); 23 struct nameidata *nd);
24static int afs_dir_open(struct inode *inode, struct file *file); 24static int afs_dir_open(struct inode *inode, struct file *file);
25static int afs_readdir(struct file *file, void *dirent, filldir_t filldir); 25static int afs_readdir(struct file *file, void *dirent, filldir_t filldir);
26static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd); 26static int afs_d_revalidate(struct dentry *dentry, unsigned int flags);
27static int afs_d_delete(const struct dentry *dentry); 27static int afs_d_delete(const struct dentry *dentry);
28static void afs_d_release(struct dentry *dentry); 28static void afs_d_release(struct dentry *dentry);
29static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, 29static int afs_lookup_filldir(void *_cookie, const char *name, int nlen,
@@ -598,7 +598,7 @@ success:
598 * - NOTE! the hit can be a negative hit too, so we can't assume we have an 598 * - NOTE! the hit can be a negative hit too, so we can't assume we have an
599 * inode 599 * inode
600 */ 600 */
601static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd) 601static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
602{ 602{
603 struct afs_vnode *vnode, *dir; 603 struct afs_vnode *vnode, *dir;
604 struct afs_fid uninitialized_var(fid); 604 struct afs_fid uninitialized_var(fid);
@@ -607,7 +607,7 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
607 void *dir_version; 607 void *dir_version;
608 int ret; 608 int ret;
609 609
610 if (nd->flags & LOOKUP_RCU) 610 if (flags & LOOKUP_RCU)
611 return -ECHILD; 611 return -ECHILD;
612 612
613 vnode = AFS_FS_I(dentry->d_inode); 613 vnode = AFS_FS_I(dentry->d_inode);
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index d42eee1c5de3..8898eef8bca9 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1042,12 +1042,12 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry)
1042/* 1042/*
1043 * Check if cached dentry can be trusted. 1043 * Check if cached dentry can be trusted.
1044 */ 1044 */
1045static int ceph_d_revalidate(struct dentry *dentry, struct nameidata *nd) 1045static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
1046{ 1046{
1047 int valid = 0; 1047 int valid = 0;
1048 struct inode *dir; 1048 struct inode *dir;
1049 1049
1050 if (nd && nd->flags & LOOKUP_RCU) 1050 if (flags & LOOKUP_RCU)
1051 return -ECHILD; 1051 return -ECHILD;
1052 1052
1053 dout("d_revalidate %p '%.*s' inode %p offset %lld\n", dentry, 1053 dout("d_revalidate %p '%.*s' inode %p offset %lld\n", dentry,
@@ -1094,7 +1094,7 @@ static void ceph_d_release(struct dentry *dentry)
1094} 1094}
1095 1095
1096static int ceph_snapdir_d_revalidate(struct dentry *dentry, 1096static int ceph_snapdir_d_revalidate(struct dentry *dentry,
1097 struct nameidata *nd) 1097 unsigned int flags)
1098{ 1098{
1099 /* 1099 /*
1100 * Eventually, we'll want to revalidate snapped metadata 1100 * Eventually, we'll want to revalidate snapped metadata
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index e8c53c80dbd5..b97ff48b7df6 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -700,9 +700,9 @@ lookup_out:
700} 700}
701 701
702static int 702static int
703cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) 703cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
704{ 704{
705 if (nd && (nd->flags & LOOKUP_RCU)) 705 if (flags & LOOKUP_RCU)
706 return -ECHILD; 706 return -ECHILD;
707 707
708 if (direntry->d_inode) { 708 if (direntry->d_inode) {
@@ -731,7 +731,7 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
731 * This may be nfsd (or something), anyway, we can't see the 731 * This may be nfsd (or something), anyway, we can't see the
732 * intent of this. So, since this can be for creation, drop it. 732 * intent of this. So, since this can be for creation, drop it.
733 */ 733 */
734 if (!nd) 734 if (!flags)
735 return 0; 735 return 0;
736 736
737 /* 737 /*
@@ -739,7 +739,7 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
739 * case sensitive name which is specified by user if this is 739 * case sensitive name which is specified by user if this is
740 * for creation. 740 * for creation.
741 */ 741 */
742 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 742 if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
743 return 0; 743 return 0;
744 744
745 if (time_after(jiffies, direntry->d_time + HZ) || !lookupCacheEnabled) 745 if (time_after(jiffies, direntry->d_time + HZ) || !lookupCacheEnabled)
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 177515829062..7f8f1a7c6d87 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -46,7 +46,7 @@ static int coda_rename(struct inode *old_inode, struct dentry *old_dentry,
46static int coda_readdir(struct file *file, void *buf, filldir_t filldir); 46static int coda_readdir(struct file *file, void *buf, filldir_t filldir);
47 47
48/* dentry ops */ 48/* dentry ops */
49static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd); 49static int coda_dentry_revalidate(struct dentry *de, unsigned int flags);
50static int coda_dentry_delete(const struct dentry *); 50static int coda_dentry_delete(const struct dentry *);
51 51
52/* support routines */ 52/* support routines */
@@ -536,12 +536,12 @@ out:
536} 536}
537 537
538/* called when a cache lookup succeeds */ 538/* called when a cache lookup succeeds */
539static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd) 539static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
540{ 540{
541 struct inode *inode; 541 struct inode *inode;
542 struct coda_inode_info *cii; 542 struct coda_inode_info *cii;
543 543
544 if (nd->flags & LOOKUP_RCU) 544 if (flags & LOOKUP_RCU)
545 return -ECHILD; 545 return -ECHILD;
546 546
547 inode = de->d_inode; 547 inode = de->d_inode;
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 534c1d46e69e..1b5d9af937df 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -32,7 +32,7 @@
32/** 32/**
33 * ecryptfs_d_revalidate - revalidate an ecryptfs dentry 33 * ecryptfs_d_revalidate - revalidate an ecryptfs dentry
34 * @dentry: The ecryptfs dentry 34 * @dentry: The ecryptfs dentry
35 * @nd: The associated nameidata 35 * @flags: lookup flags
36 * 36 *
37 * Called when the VFS needs to revalidate a dentry. This 37 * Called when the VFS needs to revalidate a dentry. This
38 * is called whenever a name lookup finds a dentry in the 38 * is called whenever a name lookup finds a dentry in the
@@ -42,32 +42,20 @@
42 * Returns 1 if valid, 0 otherwise. 42 * Returns 1 if valid, 0 otherwise.
43 * 43 *
44 */ 44 */
45static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) 45static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
46{ 46{
47 struct dentry *lower_dentry; 47 struct dentry *lower_dentry;
48 struct vfsmount *lower_mnt; 48 struct vfsmount *lower_mnt;
49 struct dentry *dentry_save = NULL;
50 struct vfsmount *vfsmount_save = NULL;
51 int rc = 1; 49 int rc = 1;
52 50
53 if (nd && nd->flags & LOOKUP_RCU) 51 if (flags & LOOKUP_RCU)
54 return -ECHILD; 52 return -ECHILD;
55 53
56 lower_dentry = ecryptfs_dentry_to_lower(dentry); 54 lower_dentry = ecryptfs_dentry_to_lower(dentry);
57 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); 55 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
58 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) 56 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
59 goto out; 57 goto out;
60 if (nd) { 58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
61 dentry_save = nd->path.dentry;
62 vfsmount_save = nd->path.mnt;
63 nd->path.dentry = lower_dentry;
64 nd->path.mnt = lower_mnt;
65 }
66 rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
67 if (nd) {
68 nd->path.dentry = dentry_save;
69 nd->path.mnt = vfsmount_save;
70 }
71 if (dentry->d_inode) { 59 if (dentry->d_inode) {
72 struct inode *lower_inode = 60 struct inode *lower_inode =
73 ecryptfs_inode_to_lower(dentry->d_inode); 61 ecryptfs_inode_to_lower(dentry->d_inode);
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 98ae804f5273..0bbdf3990060 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -41,9 +41,9 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
41 return ret; 41 return ret;
42} 42}
43 43
44static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd) 44static int vfat_revalidate(struct dentry *dentry, unsigned int flags)
45{ 45{
46 if (nd && nd->flags & LOOKUP_RCU) 46 if (flags & LOOKUP_RCU)
47 return -ECHILD; 47 return -ECHILD;
48 48
49 /* This is not negative dentry. Always valid. */ 49 /* This is not negative dentry. Always valid. */
@@ -52,9 +52,9 @@ static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
52 return vfat_revalidate_shortname(dentry); 52 return vfat_revalidate_shortname(dentry);
53} 53}
54 54
55static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd) 55static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags)
56{ 56{
57 if (nd && nd->flags & LOOKUP_RCU) 57 if (flags & LOOKUP_RCU)
58 return -ECHILD; 58 return -ECHILD;
59 59
60 /* 60 /*
@@ -74,7 +74,7 @@ static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd)
74 * This may be nfsd (or something), anyway, we can't see the 74 * This may be nfsd (or something), anyway, we can't see the
75 * intent of this. So, since this can be for creation, drop it. 75 * intent of this. So, since this can be for creation, drop it.
76 */ 76 */
77 if (!nd) 77 if (!flags)
78 return 0; 78 return 0;
79 79
80 /* 80 /*
@@ -82,7 +82,7 @@ static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd)
82 * case sensitive name which is specified by user if this is 82 * case sensitive name which is specified by user if this is
83 * for creation. 83 * for creation.
84 */ 84 */
85 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 85 if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
86 return 0; 86 return 0;
87 87
88 return vfat_revalidate_shortname(dentry); 88 return vfat_revalidate_shortname(dentry);
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index ccdab3ac4223..eba30bd9ba2b 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -154,7 +154,7 @@ u64 fuse_get_attr_version(struct fuse_conn *fc)
154 * the lookup once more. If the lookup results in the same inode, 154 * the lookup once more. If the lookup results in the same inode,
155 * then refresh the attributes, timeouts and mark the dentry valid. 155 * then refresh the attributes, timeouts and mark the dentry valid.
156 */ 156 */
157static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) 157static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
158{ 158{
159 struct inode *inode; 159 struct inode *inode;
160 160
@@ -174,7 +174,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
174 if (!inode) 174 if (!inode)
175 return 0; 175 return 0;
176 176
177 if (nd && (nd->flags & LOOKUP_RCU)) 177 if (flags & LOOKUP_RCU)
178 return -ECHILD; 178 return -ECHILD;
179 179
180 fc = get_fuse_conn(inode); 180 fc = get_fuse_conn(inode);
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c
index 0da8da2c991d..4fddb3c22d25 100644
--- a/fs/gfs2/dentry.c
+++ b/fs/gfs2/dentry.c
@@ -25,7 +25,7 @@
25/** 25/**
26 * gfs2_drevalidate - Check directory lookup consistency 26 * gfs2_drevalidate - Check directory lookup consistency
27 * @dentry: the mapping to check 27 * @dentry: the mapping to check
28 * @nd: 28 * @flags: lookup flags
29 * 29 *
30 * Check to make sure the lookup necessary to arrive at this inode from its 30 * Check to make sure the lookup necessary to arrive at this inode from its
31 * parent is still good. 31 * parent is still good.
@@ -33,7 +33,7 @@
33 * Returns: 1 if the dentry is ok, 0 if it isn't 33 * Returns: 1 if the dentry is ok, 0 if it isn't
34 */ 34 */
35 35
36static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) 36static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags)
37{ 37{
38 struct dentry *parent; 38 struct dentry *parent;
39 struct gfs2_sbd *sdp; 39 struct gfs2_sbd *sdp;
@@ -44,7 +44,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
44 int error; 44 int error;
45 int had_lock = 0; 45 int had_lock = 0;
46 46
47 if (nd && nd->flags & LOOKUP_RCU) 47 if (flags & LOOKUP_RCU)
48 return -ECHILD; 48 return -ECHILD;
49 49
50 parent = dget_parent(dentry); 50 parent = dget_parent(dentry);
diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c
index 19cf291eb91f..91b91fd3a901 100644
--- a/fs/hfs/sysdep.c
+++ b/fs/hfs/sysdep.c
@@ -13,12 +13,12 @@
13 13
14/* dentry case-handling: just lowercase everything */ 14/* dentry case-handling: just lowercase everything */
15 15
16static int hfs_revalidate_dentry(struct dentry *dentry, struct nameidata *nd) 16static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags)
17{ 17{
18 struct inode *inode; 18 struct inode *inode;
19 int diff; 19 int diff;
20 20
21 if (nd->flags & LOOKUP_RCU) 21 if (flags & LOOKUP_RCU)
22 return -ECHILD; 22 return -ECHILD;
23 23
24 inode = dentry->d_inode; 24 inode = dentry->d_inode;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 07c91ca6017d..f37977fb0871 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1570,7 +1570,7 @@ out:
1570 return result; 1570 return result;
1571} 1571}
1572 1572
1573static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd) 1573static int jfs_ci_revalidate(struct dentry *dentry, unsigned int flags)
1574{ 1574{
1575 /* 1575 /*
1576 * This is not negative dentry. Always valid. 1576 * This is not negative dentry. Always valid.
@@ -1589,7 +1589,7 @@ static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd)
1589 * This may be nfsd (or something), anyway, we can't see the 1589 * This may be nfsd (or something), anyway, we can't see the
1590 * intent of this. So, since this can be for creation, drop it. 1590 * intent of this. So, since this can be for creation, drop it.
1591 */ 1591 */
1592 if (!nd) 1592 if (!flags)
1593 return 0; 1593 return 0;
1594 1594
1595 /* 1595 /*
@@ -1597,7 +1597,7 @@ static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd)
1597 * case sensitive name which is specified by user if this is 1597 * case sensitive name which is specified by user if this is
1598 * for creation. 1598 * for creation.
1599 */ 1599 */
1600 if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) 1600 if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
1601 return 0; 1601 return 0;
1602 return 1; 1602 return 1;
1603} 1603}
diff --git a/fs/namei.c b/fs/namei.c
index 16256d915cb8..1a5707aaed36 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -465,7 +465,7 @@ err_root:
465 465
466static inline int d_revalidate(struct dentry *dentry, struct nameidata *nd) 466static inline int d_revalidate(struct dentry *dentry, struct nameidata *nd)
467{ 467{
468 return dentry->d_op->d_revalidate(dentry, nd); 468 return dentry->d_op->d_revalidate(dentry, nd ? nd->flags : 0);
469} 469}
470 470
471/** 471/**
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index aeed93a6bde0..32607f749588 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -72,7 +72,7 @@ const struct inode_operations ncp_dir_inode_operations =
72/* 72/*
73 * Dentry operations routines 73 * Dentry operations routines
74 */ 74 */
75static int ncp_lookup_validate(struct dentry *, struct nameidata *); 75static int ncp_lookup_validate(struct dentry *, unsigned int);
76static int ncp_hash_dentry(const struct dentry *, const struct inode *, 76static int ncp_hash_dentry(const struct dentry *, const struct inode *,
77 struct qstr *); 77 struct qstr *);
78static int ncp_compare_dentry(const struct dentry *, const struct inode *, 78static int ncp_compare_dentry(const struct dentry *, const struct inode *,
@@ -290,7 +290,7 @@ leave_me:;
290 290
291 291
292static int 292static int
293ncp_lookup_validate(struct dentry *dentry, struct nameidata *nd) 293ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
294{ 294{
295 struct ncp_server *server; 295 struct ncp_server *server;
296 struct dentry *parent; 296 struct dentry *parent;
@@ -302,7 +302,7 @@ ncp_lookup_validate(struct dentry *dentry, struct nameidata *nd)
302 if (dentry == dentry->d_sb->s_root) 302 if (dentry == dentry->d_sb->s_root)
303 return 1; 303 return 1;
304 304
305 if (nd->flags & LOOKUP_RCU) 305 if (flags & LOOKUP_RCU)
306 return -ECHILD; 306 return -ECHILD;
307 307
308 parent = dget_parent(dentry); 308 parent = dget_parent(dentry);
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 71a199435ca9..656f52e9aa2e 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1098,9 +1098,8 @@ int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
1098 * If the parent directory is seen to have changed, we throw out the 1098 * If the parent directory is seen to have changed, we throw out the
1099 * cached dentry and do a new lookup. 1099 * cached dentry and do a new lookup.
1100 */ 1100 */
1101static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd) 1101static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
1102{ 1102{
1103 unsigned int flags = nd->flags;
1104 struct inode *dir; 1103 struct inode *dir;
1105 struct inode *inode; 1104 struct inode *inode;
1106 struct dentry *parent; 1105 struct dentry *parent;
@@ -1339,7 +1338,7 @@ out:
1339} 1338}
1340 1339
1341#ifdef CONFIG_NFS_V4 1340#ifdef CONFIG_NFS_V4
1342static int nfs4_lookup_revalidate(struct dentry *, struct nameidata *); 1341static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
1343 1342
1344const struct dentry_operations nfs4_dentry_operations = { 1343const struct dentry_operations nfs4_dentry_operations = {
1345 .d_revalidate = nfs4_lookup_revalidate, 1344 .d_revalidate = nfs4_lookup_revalidate,
@@ -1491,9 +1490,8 @@ no_open:
1491 return finish_no_open(file, res); 1490 return finish_no_open(file, res);
1492} 1491}
1493 1492
1494static int nfs4_lookup_revalidate(struct dentry *dentry, struct nameidata *nd) 1493static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)
1495{ 1494{
1496 unsigned int flags = nd->flags;
1497 struct dentry *parent = NULL; 1495 struct dentry *parent = NULL;
1498 struct inode *inode; 1496 struct inode *inode;
1499 struct inode *dir; 1497 struct inode *dir;
@@ -1537,7 +1535,7 @@ out:
1537no_open_dput: 1535no_open_dput:
1538 dput(parent); 1536 dput(parent);
1539no_open: 1537no_open:
1540 return nfs_lookup_revalidate(dentry, nd); 1538 return nfs_lookup_revalidate(dentry, flags);
1541} 1539}
1542 1540
1543#endif /* CONFIG_NFSV4 */ 1541#endif /* CONFIG_NFSV4 */
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index af4488268e49..8db4b58b2e4b 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -49,14 +49,13 @@ void ocfs2_dentry_attach_gen(struct dentry *dentry)
49} 49}
50 50
51 51
52static int ocfs2_dentry_revalidate(struct dentry *dentry, 52static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags)
53 struct nameidata *nd)
54{ 53{
55 struct inode *inode; 54 struct inode *inode;
56 int ret = 0; /* if all else fails, just return false */ 55 int ret = 0; /* if all else fails, just return false */
57 struct ocfs2_super *osb; 56 struct ocfs2_super *osb;
58 57
59 if (nd && nd->flags & LOOKUP_RCU) 58 if (flags & LOOKUP_RCU)
60 return -ECHILD; 59 return -ECHILD;
61 60
62 inode = dentry->d_inode; 61 inode = dentry->d_inode;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 437195f204e1..bf749cca4cc6 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1601,13 +1601,13 @@ int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
1601 * made this apply to all per process world readable and executable 1601 * made this apply to all per process world readable and executable
1602 * directories. 1602 * directories.
1603 */ 1603 */
1604int pid_revalidate(struct dentry *dentry, struct nameidata *nd) 1604int pid_revalidate(struct dentry *dentry, unsigned int flags)
1605{ 1605{
1606 struct inode *inode; 1606 struct inode *inode;
1607 struct task_struct *task; 1607 struct task_struct *task;
1608 const struct cred *cred; 1608 const struct cred *cred;
1609 1609
1610 if (nd && nd->flags & LOOKUP_RCU) 1610 if (flags & LOOKUP_RCU)
1611 return -ECHILD; 1611 return -ECHILD;
1612 1612
1613 inode = dentry->d_inode; 1613 inode = dentry->d_inode;
@@ -1781,7 +1781,7 @@ static int proc_fd_link(struct dentry *dentry, struct path *path)
1781 return proc_fd_info(dentry->d_inode, path, NULL); 1781 return proc_fd_info(dentry->d_inode, path, NULL);
1782} 1782}
1783 1783
1784static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) 1784static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags)
1785{ 1785{
1786 struct inode *inode; 1786 struct inode *inode;
1787 struct task_struct *task; 1787 struct task_struct *task;
@@ -1789,7 +1789,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
1789 struct files_struct *files; 1789 struct files_struct *files;
1790 const struct cred *cred; 1790 const struct cred *cred;
1791 1791
1792 if (nd && nd->flags & LOOKUP_RCU) 1792 if (flags & LOOKUP_RCU)
1793 return -ECHILD; 1793 return -ECHILD;
1794 1794
1795 inode = dentry->d_inode; 1795 inode = dentry->d_inode;
@@ -1868,7 +1868,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
1868 d_set_d_op(dentry, &tid_fd_dentry_operations); 1868 d_set_d_op(dentry, &tid_fd_dentry_operations);
1869 d_add(dentry, inode); 1869 d_add(dentry, inode);
1870 /* Close the race of the process dying before we return the dentry */ 1870 /* Close the race of the process dying before we return the dentry */
1871 if (tid_fd_revalidate(dentry, NULL)) 1871 if (tid_fd_revalidate(dentry, 0))
1872 error = NULL; 1872 error = NULL;
1873 1873
1874 out: 1874 out:
@@ -2003,7 +2003,7 @@ static int dname_to_vma_addr(struct dentry *dentry,
2003 return 0; 2003 return 0;
2004} 2004}
2005 2005
2006static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd) 2006static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
2007{ 2007{
2008 unsigned long vm_start, vm_end; 2008 unsigned long vm_start, vm_end;
2009 bool exact_vma_exists = false; 2009 bool exact_vma_exists = false;
@@ -2013,7 +2013,7 @@ static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd)
2013 struct inode *inode; 2013 struct inode *inode;
2014 int status = 0; 2014 int status = 0;
2015 2015
2016 if (nd && nd->flags & LOOKUP_RCU) 2016 if (flags & LOOKUP_RCU)
2017 return -ECHILD; 2017 return -ECHILD;
2018 2018
2019 if (!capable(CAP_SYS_ADMIN)) { 2019 if (!capable(CAP_SYS_ADMIN)) {
@@ -2371,7 +2371,7 @@ static struct dentry *proc_fdinfo_instantiate(struct inode *dir,
2371 d_set_d_op(dentry, &tid_fd_dentry_operations); 2371 d_set_d_op(dentry, &tid_fd_dentry_operations);
2372 d_add(dentry, inode); 2372 d_add(dentry, inode);
2373 /* Close the race of the process dying before we return the dentry */ 2373 /* Close the race of the process dying before we return the dentry */
2374 if (tid_fd_revalidate(dentry, NULL)) 2374 if (tid_fd_revalidate(dentry, 0))
2375 error = NULL; 2375 error = NULL;
2376 2376
2377 out: 2377 out:
@@ -2430,7 +2430,7 @@ static struct dentry *proc_pident_instantiate(struct inode *dir,
2430 d_set_d_op(dentry, &pid_dentry_operations); 2430 d_set_d_op(dentry, &pid_dentry_operations);
2431 d_add(dentry, inode); 2431 d_add(dentry, inode);
2432 /* Close the race of the process dying before we return the dentry */ 2432 /* Close the race of the process dying before we return the dentry */
2433 if (pid_revalidate(dentry, NULL)) 2433 if (pid_revalidate(dentry, 0))
2434 error = NULL; 2434 error = NULL;
2435out: 2435out:
2436 return error; 2436 return error;
@@ -3237,7 +3237,7 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
3237 3237
3238 d_add(dentry, inode); 3238 d_add(dentry, inode);
3239 /* Close the race of the process dying before we return the dentry */ 3239 /* Close the race of the process dying before we return the dentry */
3240 if (pid_revalidate(dentry, NULL)) 3240 if (pid_revalidate(dentry, 0))
3241 error = NULL; 3241 error = NULL;
3242out: 3242out:
3243 return error; 3243 return error;
@@ -3508,7 +3508,7 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
3508 3508
3509 d_add(dentry, inode); 3509 d_add(dentry, inode);
3510 /* Close the race of the process dying before we return the dentry */ 3510 /* Close the race of the process dying before we return the dentry */
3511 if (pid_revalidate(dentry, NULL)) 3511 if (pid_revalidate(dentry, 0))
3512 error = NULL; 3512 error = NULL;
3513out: 3513out:
3514 return error; 3514 return error;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index eca4aca5b6e2..e0c2a48dab73 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -142,7 +142,7 @@ typedef struct dentry *instantiate_t(struct inode *, struct dentry *,
142int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir, 142int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
143 const char *name, int len, 143 const char *name, int len,
144 instantiate_t instantiate, struct task_struct *task, const void *ptr); 144 instantiate_t instantiate, struct task_struct *task, const void *ptr);
145int pid_revalidate(struct dentry *dentry, struct nameidata *nd); 145int pid_revalidate(struct dentry *dentry, unsigned int flags);
146struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task); 146struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task);
147extern const struct dentry_operations pid_dentry_operations; 147extern const struct dentry_operations pid_dentry_operations;
148int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); 148int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index 0d9e23a39e49..40ceb40f9853 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -56,7 +56,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir,
56 d_set_d_op(dentry, &pid_dentry_operations); 56 d_set_d_op(dentry, &pid_dentry_operations);
57 d_add(dentry, inode); 57 d_add(dentry, inode);
58 /* Close the race of the process dying before we return the dentry */ 58 /* Close the race of the process dying before we return the dentry */
59 if (pid_revalidate(dentry, NULL)) 59 if (pid_revalidate(dentry, 0))
60 error = NULL; 60 error = NULL;
61out: 61out:
62 return error; 62 return error;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 3476bca8f7af..fda69fa39099 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -794,9 +794,9 @@ static const struct inode_operations proc_sys_dir_operations = {
794 .getattr = proc_sys_getattr, 794 .getattr = proc_sys_getattr,
795}; 795};
796 796
797static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd) 797static int proc_sys_revalidate(struct dentry *dentry, unsigned int flags)
798{ 798{
799 if (nd->flags & LOOKUP_RCU) 799 if (flags & LOOKUP_RCU)
800 return -ECHILD; 800 return -ECHILD;
801 return !PROC_I(dentry->d_inode)->sysctl->unregistering; 801 return !PROC_I(dentry->d_inode)->sysctl->unregistering;
802} 802}
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 46fc1c20a6b1..e6ad8d7dea64 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -942,7 +942,7 @@ int reiserfs_permission(struct inode *inode, int mask)
942 return generic_permission(inode, mask); 942 return generic_permission(inode, mask);
943} 943}
944 944
945static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd) 945static int xattr_hide_revalidate(struct dentry *dentry, unsigned int flags)
946{ 946{
947 return -EPERM; 947 return -EPERM;
948} 948}
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index e6bb9b2a4cbe..038e74b3af87 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -303,12 +303,12 @@ static int sysfs_dentry_delete(const struct dentry *dentry)
303 return !!(sd->s_flags & SYSFS_FLAG_REMOVED); 303 return !!(sd->s_flags & SYSFS_FLAG_REMOVED);
304} 304}
305 305
306static int sysfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) 306static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
307{ 307{
308 struct sysfs_dirent *sd; 308 struct sysfs_dirent *sd;
309 int is_dir; 309 int is_dir;
310 310
311 if (nd->flags & LOOKUP_RCU) 311 if (flags & LOOKUP_RCU)
312 return -ECHILD; 312 return -ECHILD;
313 313
314 sd = dentry->d_fsdata; 314 sd = dentry->d_fsdata;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 8ca255518204..caa34e50537e 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -144,7 +144,7 @@ enum dentry_d_lock_class
144}; 144};
145 145
146struct dentry_operations { 146struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, struct nameidata *); 147 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_hash)(const struct dentry *, const struct inode *, 148 int (*d_hash)(const struct dentry *, const struct inode *,
149 struct qstr *); 149 struct qstr *);
150 int (*d_compare)(const struct dentry *, const struct inode *, 150 int (*d_compare)(const struct dentry *, const struct inode *,