Skip to content

Commit

Permalink
afs: Fix afs_d_validate() to set the right directory version
Browse files Browse the repository at this point in the history
If a dentry's version is somewhere between invalid_before and the current
directory version, we should be setting it forward to the current version,
not backwards to the invalid_before version.  Note that we're only doing
this at all because dentry::d_fsdata isn't large enough on a 32-bit system.

Fix this by using a separate variable for invalid_before so that we don't
accidentally clobber the current dir version.

Fixes: a4ff740 ("afs: Keep track of invalid-before version for dentry coherency")
Signed-off-by: David Howells <dhowells@redhat.com>
  • Loading branch information
David Howells committed Apr 13, 2020
1 parent 2105c28 commit 40fc810
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
struct dentry *parent;
struct inode *inode;
struct key *key;
afs_dataversion_t dir_version;
afs_dataversion_t dir_version, invalid_before;
long de_version;
int ret;

Expand Down Expand Up @@ -1084,8 +1084,8 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
if (de_version == (long)dir_version)
goto out_valid_noupdate;

dir_version = dir->invalid_before;
if (de_version - (long)dir_version >= 0)
invalid_before = dir->invalid_before;
if (de_version - (long)invalid_before >= 0)
goto out_valid;

_debug("dir modified");
Expand Down

0 comments on commit 40fc810

Please sign in to comment.