Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion fs/9p/vfs_dentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
struct p9_fid *fid;
struct inode *inode;
struct v9fs_inode *v9inode;
unsigned int cached;

if (flags & LOOKUP_RCU)
return -ECHILD;
Expand All @@ -75,7 +76,11 @@ static int __v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
goto out_valid;

v9inode = V9FS_I(inode);
if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) {
struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);

cached = v9ses->cache & (CACHE_META | CACHE_LOOSE);

if (!cached || v9inode->cache_validity & V9FS_INO_INVALID_ATTR) {
int retval;
struct v9fs_session_info *v9ses;

Expand Down Expand Up @@ -145,6 +150,8 @@ const struct dentry_operations v9fs_cached_dentry_operations = {
};

const struct dentry_operations v9fs_dentry_operations = {
.d_revalidate = v9fs_lookup_revalidate,
.d_weak_revalidate = __v9fs_lookup_revalidate,
.d_release = v9fs_dentry_release,
.d_unalias_trylock = v9fs_dentry_unalias_trylock,
.d_unalias_unlock = v9fs_dentry_unalias_unlock,
Expand Down
10 changes: 8 additions & 2 deletions fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,14 +1339,20 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
* Don't update inode if the file type is different
*/
umode = p9mode2unixmode(v9ses, st, &rdev);
if (inode_wrong_type(inode, umode))
if (inode_wrong_type(inode, umode)) {
/*
* Do this as a way of letting the caller know the inode should not
* be reused
*/
v9fs_invalidate_inode_attr(inode);
goto out;
}

/*
* We don't want to refresh inode->i_size,
* because we may have cached data
*/
flags = (v9ses->cache & CACHE_LOOSE) ?
flags = (v9ses->cache & (CACHE_LOOSE | CACHE_WRITEBACK)) ?
V9FS_STAT2INODE_KEEP_ISIZE : 0;
v9fs_stat2inode(st, inode, inode->i_sb, flags);
out:
Expand Down
10 changes: 8 additions & 2 deletions fs/9p/vfs_inode_dotl.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,20 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
/*
* Don't update inode if the file type is different
*/
if (inode_wrong_type(inode, st->st_mode))
if (inode_wrong_type(inode, st->st_mode)) {
/*
* Do this as a way of letting the caller know the inode should not
* be reused
*/
v9fs_invalidate_inode_attr(inode);
goto out;
}

/*
* We don't want to refresh inode->i_size,
* because we may have cached data
*/
flags = (v9ses->cache & CACHE_LOOSE) ?
flags = (v9ses->cache & (CACHE_LOOSE | CACHE_WRITEBACK)) ?
V9FS_STAT2INODE_KEEP_ISIZE : 0;
v9fs_stat2inode_dotl(st, inode, flags);
out:
Expand Down