Commit 74e938c2 authored by Martin Brandenburg's avatar Martin Brandenburg Committed by Mike Marshall

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: default avatarMartin Brandenburg <martin@omnibond.com>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent 480e5ae9
...@@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -118,8 +118,12 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
return 0; return 0;
/* We do not need to continue with negative dentries. */ /* We do not need to continue with negative dentries. */
if (!dentry->d_inode) if (!dentry->d_inode) {
goto out; 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. */ /* 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) ...@@ -129,14 +133,7 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
__FILE__, __func__, __LINE__); __FILE__, __func__, __LINE__);
return 0; return 0;
} }
if (ret == 0) return !ret;
return 0;
out:
gossip_debug(GOSSIP_DCACHE_DEBUG,
"%s: negative dentry or positive dentry and inode valid.\n",
__func__);
return 1;
} }
const struct dentry_operations orangefs_dentry_operations = { const struct dentry_operations orangefs_dentry_operations = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment