diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2021-03-09 09:07:35 +1000 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-04-25 16:28:24 -0500 |
commit | f6d2353a50aecd00e73fa3c7b20c50fd9af67b21 (patch) | |
tree | efa3483c66fafcaeebdcbee4acd3b1dd8d94728e /fs/cifs/inode.c | |
parent | ed8561fa1d12b4f880e2d8287cb69b3a0c238069 (diff) | |
download | linux-f6d2353a50aecd00e73fa3c7b20c50fd9af67b21.tar.bz2 |
cifs: check the timestamp for the cached dirent when deciding on revalidate
Improves directory metadata caching
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 22662eada74f..a0846f788436 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -2193,6 +2193,8 @@ cifs_dentry_needs_reval(struct dentry *dentry) struct inode *inode = d_inode(dentry); struct cifsInodeInfo *cifs_i = CIFS_I(inode); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); + struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); + struct cached_fid *cfid = NULL; if (cifs_i->time == 0) return true; @@ -2203,6 +2205,16 @@ cifs_dentry_needs_reval(struct dentry *dentry) if (!lookupCacheEnabled) return true; + if (!open_cached_dir_by_dentry(tcon, dentry->d_parent, &cfid)) { + mutex_lock(&cfid->fid_mutex); + if (cfid->time && cifs_i->time > cfid->time) { + mutex_unlock(&cfid->fid_mutex); + close_cached_dir(cfid); + return false; + } + mutex_unlock(&cfid->fid_mutex); + close_cached_dir(cfid); + } /* * depending on inode type, check if attribute caching disabled for * files or directories |