orangefs: reverse sense of is-inode-stale test in d_revalidate
"Linux Kernel Mailing List" <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.head |
|---|---|
| Message-ID | <[email protected]> |
Web: https://git.kernel.org/torvalds/c/74e938c22705c7b80d4422e84eea927fc78e60a8 Commit: 74e938c22705c7b80d4422e84eea927fc78e60a8 Parent: 480e5ae9b860c8a1c74ab9414f9bd78a43ad356f Refname: refs/heads/master Author: Martin Brandenburg <[email protected]> AuthorDate: Tue Feb 6 14:01:26 2018 +0000 Committer: Mike Marshall <[email protected]> CommitDate: Tue Feb 6 16:38:13 2018 -0500 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]> --- fs/orangefs/dcache.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/orangefs/dcache.c b/fs/orangefs/dcache.c index be06e1532a3b..fe484cf93e5c 100644 --- a/fs/orangefs/dcache.c +++ b/fs/orangefs/dcache.c @@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) return 0; /* We do not need to continue with negative dentries. */ - if (!dentry->d_inode) - goto out; + if (!dentry->d_inode) { + gossip_debug(GOSSIP_DCACHE_DEBUG, + "%s: negative dentry or positive dentry and inode valid.\n", + __func__); + return 1; + } /* Now we must perform a getattr to validate the inode contents. */ @@ -129,14 +133,7 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) __FILE__, __func__, __LINE__); return 0; } - if (ret == 0) - return 0;