diff mbox

[V9fs-developer,2/2,9p] Add a wstat after TCREATE to fix the gid.

Message ID 1275430547-32523-3-git-send-email-jvrao@linux.vnet.ibm.com (mailing list archive)
State Superseded
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

jvrao June 1, 2010, 10:15 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 03e751b..7159d7e 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -609,6 +609,23 @@  v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 		goto error;
 	}
 
+	/* Server grabs uid information from the fid but we need to fix
+	 * gid as dotu doesn't support sending gid on the wire with Tcreate.
+	 * hardlink is an exception as it inherits all credentials.
+	 */
+	if (v9fs_proto_dotu(v9ses) && !(perm & P9_DMLINK)) {
+		struct p9_wstat wstat;
+
+		v9fs_blank_wstat(&wstat);
+		wstat.n_gid = v9fs_get_egid(v9ses, dfid, dentry->d_parent);
+		err = p9_client_wstat(fid, &wstat);
+		if (err < 0) {
+			P9_DPRINTK(P9_DEBUG_VFS, "p9_client_wstat failed %d\n",
+					err);
+			goto error;
+		}
+	}
+
 	/* instantiate inode and assign the unopened fid to the dentry */
 	inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb);
 	if (IS_ERR(inode)) {