configfs: Remove EXPERIMENTAL
[powerpc.git] / fs / 9p / vfs_file.c
index c1f7c02..ba4b1ca 100644 (file)
@@ -67,10 +67,14 @@ int v9fs_file_open(struct inode *inode, struct file *file)
                        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;
@@ -101,7 +105,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
        P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
 
        /* No mandatory locks */
-       if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+       if (__mandatory_lock(inode))
                return -ENOLCK;
 
        if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
@@ -151,16 +155,24 @@ v9fs_file_write(struct file *filp, const char __user * data,
 {
        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);
 
        fid = filp->private_data;
        ret = p9_client_uwrite(fid, data, *offset, count);
-       if (ret > 0)
+       if (ret > 0) {
+               invalidate_inode_pages2_range(inode->i_mapping, *offset,
+                                                               *offset+ret);
                *offset += ret;
+       }
+
+       if (*offset > inode->i_size) {
+               inode->i_size = *offset;
+               inode->i_blocks = (inode->i_size + 512 - 1) >> 9;
+       }
 
-       invalidate_inode_pages2(filp->f_path.dentry->d_inode->i_mapping);
        return ret;
 }