Skip to content

Commit 0b728e1

Browse files
author
Al Viro
committed
stop passing nameidata * to ->d_revalidate()
Just the lookup flags. Die, bastard, die... Signed-off-by: Al Viro <[email protected]>
1 parent fa3c56b commit 0b728e1

File tree

25 files changed

+74
-84
lines changed

25 files changed

+74
-84
lines changed

Documentation/filesystems/Locking

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ be able to use diff(1).
99

1010
--------------------------- dentry_operations --------------------------
1111
prototypes:
12-
int (*d_revalidate)(struct dentry *, struct nameidata *);
12+
int (*d_revalidate)(struct dentry *, unsigned int);
1313
int (*d_hash)(const struct dentry *, const struct inode *,
1414
struct qstr *);
1515
int (*d_compare)(const struct dentry *, const struct inode *,

Documentation/filesystems/porting

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,8 @@ release it yourself.
431431
d_alloc_root() is gone, along with a lot of bugs caused by code
432432
misusing it. Replacement: d_make_root(inode). The difference is,
433433
d_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*
438+
take struct nameidata anymore; just the flags.

Documentation/filesystems/vfs.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ the VFS uses a default. As of kernel 2.6.22, the following members are
902902
defined:
903903

904904
struct dentry_operations {
905-
int (*d_revalidate)(struct dentry *, struct nameidata *);
905+
int (*d_revalidate)(struct dentry *, unsigned int);
906906
int (*d_hash)(const struct dentry *, const struct inode *,
907907
struct qstr *);
908908
int (*d_compare)(const struct dentry *, const struct inode *,
@@ -921,11 +921,11 @@ struct dentry_operations {
921921
dcache. Most filesystems leave this as NULL, because all their
922922
dentries in the dcache are valid
923923

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).
925925
If in rcu-walk mode, the filesystem must revalidate the dentry without
926926
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
928-
be used.
927+
used without care (because they can change and, in d_inode case, even
928+
become NULL under us).
929929

930930
If a situation is encountered that rcu-walk cannot handle, return
931931
-ECHILD and it will be called again in ref-walk mode.

fs/9p/vfs_dentry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ static void v9fs_dentry_release(struct dentry *dentry)
100100
}
101101
}
102102

103-
static int v9fs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
103+
static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
104104
{
105105
struct p9_fid *fid;
106106
struct inode *inode;
107107
struct v9fs_inode *v9inode;
108108

109-
if (nd->flags & LOOKUP_RCU)
109+
if (flags & LOOKUP_RCU)
110110
return -ECHILD;
111111

112112
inode = dentry->d_inode;

fs/afs/dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
2323
struct nameidata *nd);
2424
static int afs_dir_open(struct inode *inode, struct file *file);
2525
static int afs_readdir(struct file *file, void *dirent, filldir_t filldir);
26-
static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd);
26+
static int afs_d_revalidate(struct dentry *dentry, unsigned int flags);
2727
static int afs_d_delete(const struct dentry *dentry);
2828
static void afs_d_release(struct dentry *dentry);
2929
static int afs_lookup_filldir(void *_cookie, const char *name, int nlen,
@@ -598,7 +598,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
598598
* - NOTE! the hit can be a negative hit too, so we can't assume we have an
599599
* inode
600600
*/
601-
static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
601+
static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
602602
{
603603
struct afs_vnode *vnode, *dir;
604604
struct afs_fid uninitialized_var(fid);
@@ -607,7 +607,7 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
607607
void *dir_version;
608608
int ret;
609609

610-
if (nd->flags & LOOKUP_RCU)
610+
if (flags & LOOKUP_RCU)
611611
return -ECHILD;
612612

613613
vnode = AFS_FS_I(dentry->d_inode);

fs/ceph/dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,12 +1042,12 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry)
10421042
/*
10431043
* Check if cached dentry can be trusted.
10441044
*/
1045-
static int ceph_d_revalidate(struct dentry *dentry, struct nameidata *nd)
1045+
static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
10461046
{
10471047
int valid = 0;
10481048
struct inode *dir;
10491049

1050-
if (nd && nd->flags & LOOKUP_RCU)
1050+
if (flags & LOOKUP_RCU)
10511051
return -ECHILD;
10521052

10531053
dout("d_revalidate %p '%.*s' inode %p offset %lld\n", dentry,
@@ -1094,7 +1094,7 @@ static void ceph_d_release(struct dentry *dentry)
10941094
}
10951095

10961096
static int ceph_snapdir_d_revalidate(struct dentry *dentry,
1097-
struct nameidata *nd)
1097+
unsigned int flags)
10981098
{
10991099
/*
11001100
* Eventually, we'll want to revalidate snapped metadata

fs/cifs/dir.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,9 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
700700
}
701701

702702
static int
703-
cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
703+
cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
704704
{
705-
if (nd && (nd->flags & LOOKUP_RCU))
705+
if (flags & LOOKUP_RCU)
706706
return -ECHILD;
707707

708708
if (direntry->d_inode) {
@@ -731,15 +731,15 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
731731
* This may be nfsd (or something), anyway, we can't see the
732732
* intent of this. So, since this can be for creation, drop it.
733733
*/
734-
if (!nd)
734+
if (!flags)
735735
return 0;
736736

737737
/*
738738
* Drop the negative dentry, in order to make sure to use the
739739
* case sensitive name which is specified by user if this is
740740
* for creation.
741741
*/
742-
if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
742+
if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
743743
return 0;
744744

745745
if (time_after(jiffies, direntry->d_time + HZ) || !lookupCacheEnabled)

fs/coda/dir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int coda_rename(struct inode *old_inode, struct dentry *old_dentry,
4646
static int coda_readdir(struct file *file, void *buf, filldir_t filldir);
4747

4848
/* dentry ops */
49-
static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd);
49+
static int coda_dentry_revalidate(struct dentry *de, unsigned int flags);
5050
static int coda_dentry_delete(const struct dentry *);
5151

5252
/* support routines */
@@ -536,12 +536,12 @@ static int coda_venus_readdir(struct file *coda_file, void *buf,
536536
}
537537

538538
/* called when a cache lookup succeeds */
539-
static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd)
539+
static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
540540
{
541541
struct inode *inode;
542542
struct coda_inode_info *cii;
543543

544-
if (nd->flags & LOOKUP_RCU)
544+
if (flags & LOOKUP_RCU)
545545
return -ECHILD;
546546

547547
inode = de->d_inode;

fs/ecryptfs/dentry.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/**
3333
* ecryptfs_d_revalidate - revalidate an ecryptfs dentry
3434
* @dentry: The ecryptfs dentry
35-
* @nd: The associated nameidata
35+
* @flags: lookup flags
3636
*
3737
* Called when the VFS needs to revalidate a dentry. This
3838
* is called whenever a name lookup finds a dentry in the
@@ -42,32 +42,20 @@
4242
* Returns 1 if valid, 0 otherwise.
4343
*
4444
*/
45-
static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
45+
static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
4646
{
4747
struct dentry *lower_dentry;
4848
struct vfsmount *lower_mnt;
49-
struct dentry *dentry_save = NULL;
50-
struct vfsmount *vfsmount_save = NULL;
5149
int rc = 1;
5250

53-
if (nd && nd->flags & LOOKUP_RCU)
51+
if (flags & LOOKUP_RCU)
5452
return -ECHILD;
5553

5654
lower_dentry = ecryptfs_dentry_to_lower(dentry);
5755
lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
5856
if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
5957
goto out;
60-
if (nd) {
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-
}
58+
rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
7159
if (dentry->d_inode) {
7260
struct inode *lower_inode =
7361
ecryptfs_inode_to_lower(dentry->d_inode);

fs/fat/namei_vfat.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
4141
return ret;
4242
}
4343

44-
static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
44+
static int vfat_revalidate(struct dentry *dentry, unsigned int flags)
4545
{
46-
if (nd && nd->flags & LOOKUP_RCU)
46+
if (flags & LOOKUP_RCU)
4747
return -ECHILD;
4848

4949
/* This is not negative dentry. Always valid. */
@@ -52,9 +52,9 @@ static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
5252
return vfat_revalidate_shortname(dentry);
5353
}
5454

55-
static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd)
55+
static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags)
5656
{
57-
if (nd && nd->flags & LOOKUP_RCU)
57+
if (flags & LOOKUP_RCU)
5858
return -ECHILD;
5959

6060
/*
@@ -74,15 +74,15 @@ static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd)
7474
* This may be nfsd (or something), anyway, we can't see the
7575
* intent of this. So, since this can be for creation, drop it.
7676
*/
77-
if (!nd)
77+
if (!flags)
7878
return 0;
7979

8080
/*
8181
* Drop the negative dentry, in order to make sure to use the
8282
* case sensitive name which is specified by user if this is
8383
* for creation.
8484
*/
85-
if (nd->flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
85+
if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
8686
return 0;
8787

8888
return vfat_revalidate_shortname(dentry);

0 commit comments

Comments
 (0)