Skip to content

Commit 40c845c

Browse files
rohiths-msftsmfrench
authored andcommitted
Invalidate fscache cookie only when inode attributes are changed.
For example if mtime or size has changed. Signed-off-by: Rohith Surabattula <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 46f5cbd commit 40c845c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/cifs/inode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static void cifs_set_ops(struct inode *inode)
8383
static void
8484
cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
8585
{
86+
struct cifs_fscache_inode_coherency_data cd;
8687
struct cifsInodeInfo *cifs_i = CIFS_I(inode);
8788

8889
cifs_dbg(FYI, "%s: revalidating inode %llu\n",
@@ -113,6 +114,9 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
113114
cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n",
114115
__func__, cifs_i->uniqueid);
115116
set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
117+
/* Invalidate fscache cookie */
118+
cifs_fscache_fill_coherency(&cifs_i->vfs_inode, &cd);
119+
fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
116120
}
117121

118122
/*
@@ -2261,8 +2265,6 @@ cifs_dentry_needs_reval(struct dentry *dentry)
22612265
int
22622266
cifs_invalidate_mapping(struct inode *inode)
22632267
{
2264-
struct cifs_fscache_inode_coherency_data cd;
2265-
struct cifsInodeInfo *cifsi = CIFS_I(inode);
22662268
int rc = 0;
22672269

22682270
if (inode->i_mapping && inode->i_mapping->nrpages != 0) {
@@ -2272,8 +2274,6 @@ cifs_invalidate_mapping(struct inode *inode)
22722274
__func__, inode);
22732275
}
22742276

2275-
cifs_fscache_fill_coherency(&cifsi->vfs_inode, &cd);
2276-
fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
22772277
return rc;
22782278
}
22792279

0 commit comments

Comments
 (0)