diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/vfs_file.c | 14 | ||||
-rw-r--r-- | fs/9p/vfs_inode.c | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index c1f7c027cfeb..2a40c2946d0a 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -67,10 +67,14 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
67 | return PTR_ERR(fid); | 67 | return PTR_ERR(fid); |
68 | 68 | ||
69 | err = p9_client_open(fid, omode); | 69 | err = p9_client_open(fid, omode); |
70 | if (err < 0) { | 70 | if (err < 0) { |
71 | p9_client_clunk(fid); | 71 | p9_client_clunk(fid); |
72 | return err; | 72 | return err; |
73 | } | 73 | } |
74 | if (omode & P9_OTRUNC) { | ||
75 | inode->i_size = 0; | ||
76 | inode->i_blocks = 0; | ||
77 | } | ||
74 | } | 78 | } |
75 | 79 | ||
76 | file->private_data = fid; | 80 | file->private_data = fid; |
@@ -151,6 +155,7 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
151 | { | 155 | { |
152 | int ret; | 156 | int ret; |
153 | struct p9_fid *fid; | 157 | struct p9_fid *fid; |
158 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
154 | 159 | ||
155 | P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data, | 160 | P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data, |
156 | (int)count, (int)*offset); | 161 | (int)count, (int)*offset); |
@@ -160,7 +165,12 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
160 | if (ret > 0) | 165 | if (ret > 0) |
161 | *offset += ret; | 166 | *offset += ret; |
162 | 167 | ||
163 | invalidate_inode_pages2(filp->f_path.dentry->d_inode->i_mapping); | 168 | if (*offset > inode->i_size) { |
169 | inode->i_size = *offset; | ||
170 | inode->i_blocks = (inode->i_size + 512 - 1) >> 9; | ||
171 | } | ||
172 | |||
173 | invalidate_inode_pages2(inode->i_mapping); | ||
164 | return ret; | 174 | return ret; |
165 | } | 175 | } |
166 | 176 | ||
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index c602c0e054a2..e5c45eed58a9 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -716,6 +716,9 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
716 | P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); | 716 | P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry); |
717 | err = -EPERM; | 717 | err = -EPERM; |
718 | v9ses = v9fs_inode2v9ses(dentry->d_inode); | 718 | v9ses = v9fs_inode2v9ses(dentry->d_inode); |
719 | if (v9ses->cache == CACHE_LOOSE) | ||
720 | return simple_getattr(mnt, dentry, stat); | ||
721 | |||
719 | fid = v9fs_fid_lookup(dentry); | 722 | fid = v9fs_fid_lookup(dentry); |
720 | if (IS_ERR(fid)) | 723 | if (IS_ERR(fid)) |
721 | return PTR_ERR(fid); | 724 | return PTR_ERR(fid); |