diff mbox

[V9fs-developer] Use existing stat info while doing setattr

Message ID 1269851336-28337-1-git-send-email-mohan@in.ibm.com (mailing list archive)
State Rejected
Headers show

Commit Message

M. Mohan Kumar March 29, 2010, 8:28 a.m. UTC
None
diff mbox

Patch

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index ae83967..da56571 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -841,7 +841,7 @@  static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 	int retval;
 	struct v9fs_session_info *v9ses;
 	struct p9_fid *fid;
-	struct p9_wstat wstat;
+	struct p9_wstat *stat;
 
 	P9_DPRINTK(P9_DEBUG_VFS, "\n");
 	retval = -EPERM;
@@ -850,31 +850,35 @@  static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 	if(IS_ERR(fid))
 		return PTR_ERR(fid);
 
-	v9fs_blank_wstat(&wstat);
+	stat = p9_client_stat(fid);
+	if (IS_ERR(stat))
+		return PTR_ERR(stat);
+
 	if (iattr->ia_valid & ATTR_MODE)
-		wstat.mode = unixmode2p9mode(v9ses, iattr->ia_mode);
+		stat->mode = unixmode2p9mode(v9ses, iattr->ia_mode);
 
 	if (iattr->ia_valid & ATTR_MTIME)
-		wstat.mtime = iattr->ia_mtime.tv_sec;
+		stat->mtime = iattr->ia_mtime.tv_sec;
 
 	if (iattr->ia_valid & ATTR_ATIME)
-		wstat.atime = iattr->ia_atime.tv_sec;
+		stat->atime = iattr->ia_atime.tv_sec;
 
 	if (iattr->ia_valid & ATTR_SIZE)
-		wstat.length = iattr->ia_size;
+		stat->length = iattr->ia_size;
 
 	if (v9fs_proto_dotu(v9ses)) {
 		if (iattr->ia_valid & ATTR_UID)
-			wstat.n_uid = iattr->ia_uid;
+			stat->n_uid = iattr->ia_uid;
 
 		if (iattr->ia_valid & ATTR_GID)
-			wstat.n_gid = iattr->ia_gid;
+			stat->n_gid = iattr->ia_gid;
 	}
 
-	retval = p9_client_wstat(fid, &wstat);
+	retval = p9_client_wstat(fid, stat);
 	if (retval >= 0)
 		retval = inode_setattr(dentry->d_inode, iattr);
 
+	kfree(stat);
 	return retval;
 }