aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r--fs/9p/vfs_inode.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 85ff859d3af5..72b779bc0942 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -538,7 +538,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
538 if (retval) 538 if (retval)
539 goto error; 539 goto error;
540 540
541 v9fs_stat2inode(st, inode, sb); 541 v9fs_stat2inode(st, inode, sb, 0);
542 v9fs_cache_inode_get_cookie(inode); 542 v9fs_cache_inode_get_cookie(inode);
543 unlock_new_inode(inode); 543 unlock_new_inode(inode);
544 return inode; 544 return inode;
@@ -1092,7 +1092,7 @@ v9fs_vfs_getattr(const struct path *path, struct kstat *stat,
1092 if (IS_ERR(st)) 1092 if (IS_ERR(st))
1093 return PTR_ERR(st); 1093 return PTR_ERR(st);
1094 1094
1095 v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb); 1095 v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb, 0);
1096 generic_fillattr(d_inode(dentry), stat); 1096 generic_fillattr(d_inode(dentry), stat);
1097 1097
1098 p9stat_free(st); 1098 p9stat_free(st);
@@ -1170,12 +1170,13 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
1170 * @stat: Plan 9 metadata (mistat) structure 1170 * @stat: Plan 9 metadata (mistat) structure
1171 * @inode: inode to populate 1171 * @inode: inode to populate
1172 * @sb: superblock of filesystem 1172 * @sb: superblock of filesystem
1173 * @flags: control flags (e.g. V9FS_STAT2INODE_KEEP_ISIZE)
1173 * 1174 *
1174 */ 1175 */
1175 1176
1176void 1177void
1177v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, 1178v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
1178 struct super_block *sb) 1179 struct super_block *sb, unsigned int flags)
1179{ 1180{
1180 umode_t mode; 1181 umode_t mode;
1181 char ext[32]; 1182 char ext[32];
@@ -1216,10 +1217,11 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
1216 mode = p9mode2perm(v9ses, stat); 1217 mode = p9mode2perm(v9ses, stat);
1217 mode |= inode->i_mode & ~S_IALLUGO; 1218 mode |= inode->i_mode & ~S_IALLUGO;
1218 inode->i_mode = mode; 1219 inode->i_mode = mode;
1219 i_size_write(inode, stat->length);
1220 1220
1221 if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE))
1222 v9fs_i_size_write(inode, stat->length);
1221 /* not real number of blocks, but 512 byte ones ... */ 1223 /* not real number of blocks, but 512 byte ones ... */
1222 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9; 1224 inode->i_blocks = (stat->length + 512 - 1) >> 9;
1223 v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR; 1225 v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
1224} 1226}
1225 1227
@@ -1416,9 +1418,9 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
1416{ 1418{
1417 int umode; 1419 int umode;
1418 dev_t rdev; 1420 dev_t rdev;
1419 loff_t i_size;
1420 struct p9_wstat *st; 1421 struct p9_wstat *st;
1421 struct v9fs_session_info *v9ses; 1422 struct v9fs_session_info *v9ses;
1423 unsigned int flags;
1422 1424
1423 v9ses = v9fs_inode2v9ses(inode); 1425 v9ses = v9fs_inode2v9ses(inode);
1424 st = p9_client_stat(fid); 1426 st = p9_client_stat(fid);
@@ -1431,16 +1433,13 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
1431 if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) 1433 if ((inode->i_mode & S_IFMT) != (umode & S_IFMT))
1432 goto out; 1434 goto out;
1433 1435
1434 spin_lock(&inode->i_lock);
1435 /* 1436 /*
1436 * We don't want to refresh inode->i_size, 1437 * We don't want to refresh inode->i_size,
1437 * because we may have cached data 1438 * because we may have cached data
1438 */ 1439 */
1439 i_size = inode->i_size; 1440 flags = (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) ?
1440 v9fs_stat2inode(st, inode, inode->i_sb); 1441 V9FS_STAT2INODE_KEEP_ISIZE : 0;
1441 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) 1442 v9fs_stat2inode(st, inode, inode->i_sb, flags);
1442 inode->i_size = i_size;
1443 spin_unlock(&inode->i_lock);
1444out: 1443out:
1445 p9stat_free(st); 1444 p9stat_free(st);
1446 kfree(st); 1445 kfree(st);