aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode_dotl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/vfs_inode_dotl.c')
-rw-r--r--fs/9p/vfs_inode_dotl.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 4823e1c46999..a950a927a626 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -143,7 +143,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
143 if (retval) 143 if (retval)
144 goto error; 144 goto error;
145 145
146 v9fs_stat2inode_dotl(st, inode); 146 v9fs_stat2inode_dotl(st, inode, 0);
147 v9fs_cache_inode_get_cookie(inode); 147 v9fs_cache_inode_get_cookie(inode);
148 retval = v9fs_get_acl(inode, fid); 148 retval = v9fs_get_acl(inode, fid);
149 if (retval) 149 if (retval)
@@ -496,7 +496,7 @@ v9fs_vfs_getattr_dotl(const struct path *path, struct kstat *stat,
496 if (IS_ERR(st)) 496 if (IS_ERR(st))
497 return PTR_ERR(st); 497 return PTR_ERR(st);
498 498
499 v9fs_stat2inode_dotl(st, d_inode(dentry)); 499 v9fs_stat2inode_dotl(st, d_inode(dentry), 0);
500 generic_fillattr(d_inode(dentry), stat); 500 generic_fillattr(d_inode(dentry), stat);
501 /* Change block size to what the server returned */ 501 /* Change block size to what the server returned */
502 stat->blksize = st->st_blksize; 502 stat->blksize = st->st_blksize;
@@ -607,11 +607,13 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
607 * v9fs_stat2inode_dotl - populate an inode structure with stat info 607 * v9fs_stat2inode_dotl - populate an inode structure with stat info
608 * @stat: stat structure 608 * @stat: stat structure
609 * @inode: inode to populate 609 * @inode: inode to populate
610 * @flags: ctrl flags (e.g. V9FS_STAT2INODE_KEEP_ISIZE)
610 * 611 *
611 */ 612 */
612 613
613void 614void
614v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) 615v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
616 unsigned int flags)
615{ 617{
616 umode_t mode; 618 umode_t mode;
617 struct v9fs_inode *v9inode = V9FS_I(inode); 619 struct v9fs_inode *v9inode = V9FS_I(inode);
@@ -631,7 +633,8 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
631 mode |= inode->i_mode & ~S_IALLUGO; 633 mode |= inode->i_mode & ~S_IALLUGO;
632 inode->i_mode = mode; 634 inode->i_mode = mode;
633 635
634 i_size_write(inode, stat->st_size); 636 if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE))
637 v9fs_i_size_write(inode, stat->st_size);
635 inode->i_blocks = stat->st_blocks; 638 inode->i_blocks = stat->st_blocks;
636 } else { 639 } else {
637 if (stat->st_result_mask & P9_STATS_ATIME) { 640 if (stat->st_result_mask & P9_STATS_ATIME) {
@@ -661,8 +664,9 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
661 } 664 }
662 if (stat->st_result_mask & P9_STATS_RDEV) 665 if (stat->st_result_mask & P9_STATS_RDEV)
663 inode->i_rdev = new_decode_dev(stat->st_rdev); 666 inode->i_rdev = new_decode_dev(stat->st_rdev);
664 if (stat->st_result_mask & P9_STATS_SIZE) 667 if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE) &&
665 i_size_write(inode, stat->st_size); 668 stat->st_result_mask & P9_STATS_SIZE)
669 v9fs_i_size_write(inode, stat->st_size);
666 if (stat->st_result_mask & P9_STATS_BLOCKS) 670 if (stat->st_result_mask & P9_STATS_BLOCKS)
667 inode->i_blocks = stat->st_blocks; 671 inode->i_blocks = stat->st_blocks;
668 } 672 }
@@ -928,9 +932,9 @@ v9fs_vfs_get_link_dotl(struct dentry *dentry,
928 932
929int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) 933int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
930{ 934{
931 loff_t i_size;
932 struct p9_stat_dotl *st; 935 struct p9_stat_dotl *st;
933 struct v9fs_session_info *v9ses; 936 struct v9fs_session_info *v9ses;
937 unsigned int flags;
934 938
935 v9ses = v9fs_inode2v9ses(inode); 939 v9ses = v9fs_inode2v9ses(inode);
936 st = p9_client_getattr_dotl(fid, P9_STATS_ALL); 940 st = p9_client_getattr_dotl(fid, P9_STATS_ALL);
@@ -942,16 +946,13 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
942 if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) 946 if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT))
943 goto out; 947 goto out;
944 948
945 spin_lock(&inode->i_lock);
946 /* 949 /*
947 * We don't want to refresh inode->i_size, 950 * We don't want to refresh inode->i_size,
948 * because we may have cached data 951 * because we may have cached data
949 */ 952 */
950 i_size = inode->i_size; 953 flags = (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) ?
951 v9fs_stat2inode_dotl(st, inode); 954 V9FS_STAT2INODE_KEEP_ISIZE : 0;
952 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) 955 v9fs_stat2inode_dotl(st, inode, flags);
953 inode->i_size = i_size;
954 spin_unlock(&inode->i_lock);
955out: 956out:
956 kfree(st); 957 kfree(st);
957 return 0; 958 return 0;