Skip to content

Commit 74e938c

Browse files
Martin Brandenburghubcapsc
authored andcommitted
orangefs: reverse sense of is-inode-stale test in d_revalidate
If a dentry is deleted, then a dentry is recreated with the same handle but a different type (i.e. it was a file and now it's a symlink), then its a different inode. The check was backwards, so d_revalidate would not have noticed. Due to the design of the OrangeFS server, this is rather unlikely. It's also possible for the dentry to be deleted and recreated with the same type. This would be undetectable. It's a bit of a ship of Theseus. Signed-off-by: Martin Brandenburg <[email protected]> Signed-off-by: Mike Marshall <[email protected]>
1 parent 480e5ae commit 74e938c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

fs/orangefs/dcache.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
118118
return 0;
119119

120120
/* We do not need to continue with negative dentries. */
121-
if (!dentry->d_inode)
122-
goto out;
121+
if (!dentry->d_inode) {
122+
gossip_debug(GOSSIP_DCACHE_DEBUG,
123+
"%s: negative dentry or positive dentry and inode valid.\n",
124+
__func__);
125+
return 1;
126+
}
123127

124128
/* Now we must perform a getattr to validate the inode contents. */
125129

@@ -129,14 +133,7 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
129133
__FILE__, __func__, __LINE__);
130134
return 0;
131135
}
132-
if (ret == 0)
133-
return 0;
134-
135-
out:
136-
gossip_debug(GOSSIP_DCACHE_DEBUG,
137-
"%s: negative dentry or positive dentry and inode valid.\n",
138-
__func__);
139-
return 1;
136+
return !ret;
140137
}
141138

142139
const struct dentry_operations orangefs_dentry_operations = {

0 commit comments

Comments
 (0)