return PTR_ERR(fid);
err = p9_client_open(fid, omode);
- if (err < 0) {
+ if (err < 0) {
p9_client_clunk(fid);
return err;
}
+ if (omode & P9_OTRUNC) {
+ inode->i_size = 0;
+ inode->i_blocks = 0;
+ }
}
file->private_data = fid;
{
int ret;
struct p9_fid *fid;
+ struct inode *inode = filp->f_path.dentry->d_inode;
P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
(int)count, (int)*offset);
if (ret > 0)
*offset += ret;
- invalidate_inode_pages2(filp->f_path.dentry->d_inode->i_mapping);
+ if (*offset > inode->i_size) {
+ inode->i_size = *offset;
+ inode->i_blocks = (inode->i_size + 512 - 1) >> 9;
+ }
+
+ invalidate_inode_pages2(inode->i_mapping);
return ret;
}
P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
err = -EPERM;
v9ses = v9fs_inode2v9ses(dentry->d_inode);
+ if (v9ses->cache == CACHE_LOOSE)
+ return simple_getattr(mnt, dentry, stat);
+
fid = v9fs_fid_lookup(dentry);
if (IS_ERR(fid))
return PTR_ERR(fid);