fs/9p: Properly update inode attributes on link
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 28 Feb 2011 11:34:09 +0000 (17:04 +0530)
committerEric Van Hensbergen <ericvh@gmail.com>
Tue, 15 Mar 2011 14:57:42 +0000 (09:57 -0500)
With caching enabled, we need to make sure we don't
update inode->i_size via stat2inode because we could
have dirty data which is not yet written to the server

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c

index 8e9d603..524d255 100644 (file)
@@ -1292,8 +1292,10 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
        sprintf(name, "%d\n", oldfid->fid);
        retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name);
        __putname(name);
-       if (!retval)
+       if (!retval) {
+               v9fs_refresh_inode(oldfid, old_dentry->d_inode);
                v9fs_invalidate_inode_attr(dir);
+       }
 clunk_fid:
        p9_client_clunk(oldfid);
        return retval;
index 4d4c70e..81bb4c2 100644 (file)
@@ -671,19 +671,11 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *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);