aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/v9fs_vfs.h2
-rw-r--r--fs/9p/vfs_inode.c19
-rw-r--r--fs/9p/vfs_super.c4
3 files changed, 18 insertions, 7 deletions
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index f47c6bbb01b3..88418c419ea7 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -52,7 +52,7 @@ void v9fs_destroy_inode(struct inode *inode);
52#endif 52#endif
53 53
54struct inode *v9fs_get_inode(struct super_block *sb, int mode); 54struct inode *v9fs_get_inode(struct super_block *sb, int mode);
55void v9fs_clear_inode(struct inode *inode); 55void v9fs_evict_inode(struct inode *inode);
56ino_t v9fs_qid2ino(struct p9_qid *qid); 56ino_t v9fs_qid2ino(struct p9_qid *qid);
57void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); 57void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *);
58void v9fs_stat2inode_dotl(struct p9_stat_dotl *, struct inode *); 58void v9fs_stat2inode_dotl(struct p9_stat_dotl *, struct inode *);
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 6e94f3247cec..d97c34a24f7a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -430,8 +430,10 @@ error:
430 * @inode: inode to release 430 * @inode: inode to release
431 * 431 *
432 */ 432 */
433void v9fs_clear_inode(struct inode *inode) 433void v9fs_evict_inode(struct inode *inode)
434{ 434{
435 truncate_inode_pages(inode->i_mapping, 0);
436 end_writeback(inode);
435 filemap_fdatawrite(inode->i_mapping); 437 filemap_fdatawrite(inode->i_mapping);
436 438
437#ifdef CONFIG_9P_FSCACHE 439#ifdef CONFIG_9P_FSCACHE
@@ -1209,10 +1211,19 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
1209 } 1211 }
1210 1212
1211 retval = p9_client_wstat(fid, &wstat); 1213 retval = p9_client_wstat(fid, &wstat);
1212 if (retval >= 0) 1214 if (retval < 0)
1213 retval = inode_setattr(dentry->d_inode, iattr); 1215 return retval;
1214 1216
1215 return retval; 1217 if ((iattr->ia_valid & ATTR_SIZE) &&
1218 iattr->ia_size != i_size_read(dentry->d_inode)) {
1219 retval = vmtruncate(dentry->d_inode, iattr->ia_size);
1220 if (retval)
1221 return retval;
1222 }
1223
1224 setattr_copy(dentry->d_inode, iattr);
1225 mark_inode_dirty(dentry->d_inode);
1226 return 0;
1216} 1227}
1217 1228
1218/** 1229/**
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 4b9ede0b41b7..f9311077de68 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -266,7 +266,7 @@ static const struct super_operations v9fs_super_ops = {
266 .destroy_inode = v9fs_destroy_inode, 266 .destroy_inode = v9fs_destroy_inode,
267#endif 267#endif
268 .statfs = simple_statfs, 268 .statfs = simple_statfs,
269 .clear_inode = v9fs_clear_inode, 269 .evict_inode = v9fs_evict_inode,
270 .show_options = generic_show_options, 270 .show_options = generic_show_options,
271 .umount_begin = v9fs_umount_begin, 271 .umount_begin = v9fs_umount_begin,
272}; 272};
@@ -277,7 +277,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
277 .destroy_inode = v9fs_destroy_inode, 277 .destroy_inode = v9fs_destroy_inode,
278#endif 278#endif
279 .statfs = v9fs_statfs, 279 .statfs = v9fs_statfs,
280 .clear_inode = v9fs_clear_inode, 280 .evict_inode = v9fs_evict_inode,
281 .show_options = generic_show_options, 281 .show_options = generic_show_options,
282 .umount_begin = v9fs_umount_begin, 282 .umount_begin = v9fs_umount_begin,
283}; 283};