Merge branch 'vhost-net-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mst...
[pandora-kernel.git] / fs / 9p / vfs_inode_dotl.c
index 5c04d66..67c138e 100644 (file)
@@ -220,6 +220,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
                                err);
                goto error;
        }
+       v9fs_invalidate_inode_attr(dir);
 
        /* instantiate inode and assign the unopened fid to the dentry */
        fid = p9_client_walk(dfid, 1, &name, 1);
@@ -372,6 +373,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
        /* Now set the ACL based on the default value */
        v9fs_set_create_acl(dentry, dacl, pacl);
        inc_nlink(dir);
+       v9fs_invalidate_inode_attr(dir);
 error:
        if (fid)
                p9_client_clunk(fid);
@@ -451,16 +453,20 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
        if (IS_ERR(fid))
                return PTR_ERR(fid);
 
-       retval = p9_client_setattr(fid, &p9attr);
-       if (retval < 0)
-               return retval;
-
        if ((iattr->ia_valid & ATTR_SIZE) &&
            iattr->ia_size != i_size_read(dentry->d_inode)) {
                retval = vmtruncate(dentry->d_inode, iattr->ia_size);
                if (retval)
                        return retval;
        }
+       /* Write all dirty data */
+       if (S_ISREG(dentry->d_inode->i_mode))
+               filemap_write_and_wait(dentry->d_inode->i_mapping);
+
+       retval = p9_client_setattr(fid, &p9attr);
+       if (retval < 0)
+               return retval;
+       v9fs_invalidate_inode_attr(dentry->d_inode);
 
        setattr_copy(dentry->d_inode, iattr);
        mark_inode_dirty(dentry->d_inode);
@@ -550,14 +556,14 @@ static int
 v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
                const char *symname)
 {
-       struct v9fs_session_info *v9ses;
-       struct p9_fid *dfid;
-       struct p9_fid *fid = NULL;
-       struct inode *inode;
-       struct p9_qid qid;
-       char *name;
        int err;
        gid_t gid;
+       char *name;
+       struct p9_qid qid;
+       struct inode *inode;
+       struct p9_fid *dfid;
+       struct p9_fid *fid = NULL;
+       struct v9fs_session_info *v9ses;
 
        name = (char *) dentry->d_name.name;
        P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n",
@@ -581,6 +587,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
                goto error;
        }
 
+       v9fs_invalidate_inode_attr(dir);
        if (v9ses->cache) {
                /* Now walk from the parent so we can get an unopened fid. */
                fid = p9_client_walk(dfid, 1, &name, 1);
@@ -635,10 +642,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
                struct dentry *dentry)
 {
        int err;
-       struct p9_fid *dfid, *oldfid;
        char *name;
-       struct v9fs_session_info *v9ses;
        struct dentry *dir_dentry;
+       struct p9_fid *dfid, *oldfid;
+       struct v9fs_session_info *v9ses;
 
        P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
                        dir->i_ino, old_dentry->d_name.name,
@@ -663,22 +670,15 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
                return err;
        }
 
+       v9fs_invalidate_inode_attr(dir);
        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
                /* Get the latest stat info from server. */
                struct p9_fid *fid;
-               struct p9_stat_dotl *st;
-
                fid = v9fs_fid_lookup(old_dentry);
                if (IS_ERR(fid))
                        return PTR_ERR(fid);
 
-               st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
-               if (IS_ERR(st))
-                       return PTR_ERR(st);
-
-               v9fs_stat2inode_dotl(st, old_dentry->d_inode);
-
-               kfree(st);
+               v9fs_refresh_inode_dotl(fid, old_dentry->d_inode);
        }
        ihold(old_dentry->d_inode);
        d_instantiate(dentry, old_dentry->d_inode);
@@ -699,12 +699,12 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
                dev_t rdev)
 {
        int err;
+       gid_t gid;
        char *name;
        mode_t mode;
        struct v9fs_session_info *v9ses;
        struct p9_fid *fid = NULL, *dfid = NULL;
        struct inode *inode;
-       gid_t gid;
        struct p9_qid qid;
        struct dentry *dir_dentry;
        struct posix_acl *dacl = NULL, *pacl = NULL;
@@ -741,6 +741,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
        if (err < 0)
                goto error;
 
+       v9fs_invalidate_inode_attr(dir);
        /* instantiate inode and assign the unopened fid to the dentry */
        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
                fid = p9_client_walk(dfid, 1, &name, 1);