diff -NurpP linux-3.9.4-vs2.3.6.1/fs/ext2/ialloc.c linux-3.9.4-vs2.3.6.2/fs/ext2/ialloc.c
--- linux-3.9.4-vs2.3.6.1/fs/ext2/ialloc.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/fs/ext2/ialloc.c	2013-06-01 09:31:28.000000000 +0000
@@ -547,7 +547,8 @@ got:
 		inode->i_mode = mode;
 		inode->i_uid = current_fsuid();
 		inode->i_gid = dir->i_gid;
-		inode->i_tag = dx_current_fstag(sb);
+		inode->i_tag = make_ktag(&init_user_ns,
+			dx_current_fstag(sb));
 	} else
 		inode_init_owner(inode, dir, mode);
 
diff -NurpP linux-3.9.4-vs2.3.6.1/fs/ext3/ialloc.c linux-3.9.4-vs2.3.6.2/fs/ext3/ialloc.c
--- linux-3.9.4-vs2.3.6.1/fs/ext3/ialloc.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/fs/ext3/ialloc.c	2013-06-01 09:40:15.000000000 +0000
@@ -470,7 +470,8 @@ got:
 		inode->i_mode = mode;
 		inode->i_uid = current_fsuid();
 		inode->i_gid = dir->i_gid;
-		inode->i_tag = dx_current_fstag(sb);
+		inode->i_tag = make_ktag(&init_user_ns,
+			dx_current_fstag(sb));
 	} else
 		inode_init_owner(inode, dir, mode);
 
diff -NurpP linux-3.9.4-vs2.3.6.1/fs/ext4/ialloc.c linux-3.9.4-vs2.3.6.2/fs/ext4/ialloc.c
--- linux-3.9.4-vs2.3.6.1/fs/ext4/ialloc.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/fs/ext4/ialloc.c	2013-06-01 09:46:49.000000000 +0000
@@ -860,7 +860,8 @@ got:
 		inode->i_mode = mode;
 		inode->i_uid = current_fsuid();
 		inode->i_gid = dir->i_gid;
-		inode->i_tag = dx_current_fstag(sb);
+		inode->i_tag = make_ktag(&init_user_ns,
+			dx_current_fstag(sb));
 	} else
 		inode_init_owner(inode, dir, mode);
 
diff -NurpP linux-3.9.4-vs2.3.6.1/fs/inode.c linux-3.9.4-vs2.3.6.2/fs/inode.c
--- linux-3.9.4-vs2.3.6.1/fs/inode.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/fs/inode.c	2013-06-01 09:01:48.000000000 +0000
@@ -1839,7 +1839,7 @@ void inode_init_owner(struct inode *inod
 	} else
 		inode->i_gid = current_fsgid();
 	inode->i_mode = mode;
-	inode->i_tag = dx_current_fstag(inode->i_sb);
+	i_tag_write(inode, dx_current_fstag(inode->i_sb));
 }
 EXPORT_SYMBOL(inode_init_owner);
 
diff -NurpP linux-3.9.4-vs2.3.6.1/fs/namei.c linux-3.9.4-vs2.3.6.2/fs/namei.c
--- linux-3.9.4-vs2.3.6.1/fs/namei.c	2013-06-01 00:22:21.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/fs/namei.c	2013-06-01 09:00:16.000000000 +0000
@@ -351,8 +351,8 @@ int dx_permission(const struct inode *in
 #endif
 		    vxwprintk_task(1,
 			"denied [0x%x] access to inode %s:%p[#%d,%lu]",
-			mask, inode->i_sb->s_id, inode, inode->i_tag,
-			inode->i_ino);
+			mask, inode->i_sb->s_id, inode,
+			i_tag_read(inode), inode->i_ino);
 	}
 	return ret;
 }
diff -NurpP linux-3.9.4-vs2.3.6.1/fs/open.c linux-3.9.4-vs2.3.6.2/fs/open.c
--- linux-3.9.4-vs2.3.6.1/fs/open.c	2013-05-31 21:09:19.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/fs/open.c	2013-06-01 08:41:29.000000000 +0000
@@ -581,13 +581,15 @@ static int chown_common(struct path *pat
 		if (!uid_valid(uid))
 			return -EINVAL;
 		newattrs.ia_valid |= ATTR_UID;
-		newattrs.ia_uid = dx_map_uid(user);
+		newattrs.ia_uid = make_kuid(&init_user_ns,
+			dx_map_uid(user));
 	}
 	if (group != (gid_t) -1) {
 		if (!gid_valid(gid))
 			return -EINVAL;
 		newattrs.ia_valid |= ATTR_GID;
-		newattrs.ia_gid = dx_map_gid(group);
+		newattrs.ia_gid = make_kgid(&init_user_ns,
+			dx_map_gid(group));
 	}
 	if (!S_ISDIR(inode->i_mode))
 		newattrs.ia_valid |=
diff -NurpP linux-3.9.4-vs2.3.6.1/include/linux/stat.h linux-3.9.4-vs2.3.6.2/include/linux/stat.h
--- linux-3.9.4-vs2.3.6.1/include/linux/stat.h	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/include/linux/stat.h	2013-06-01 08:53:13.000000000 +0000
@@ -25,7 +25,7 @@ struct kstat {
 	unsigned int	nlink;
 	kuid_t		uid;
 	kgid_t		gid;
-	tag_t		tag;
+	ktag_t		tag;
 	dev_t		rdev;
 	loff_t		size;
 	struct timespec  atime;
diff -NurpP linux-3.9.4-vs2.3.6.1/include/linux/vserver/tag.h linux-3.9.4-vs2.3.6.2/include/linux/vserver/tag.h
--- linux-3.9.4-vs2.3.6.1/include/linux/vserver/tag.h	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/include/linux/vserver/tag.h	2013-06-01 08:36:17.000000000 +0000
@@ -113,6 +113,9 @@ static inline uid_t dx_map_uid(uid_t uid
 	return (uid & MAX_UID);
 }
 
+#define	dx_map_kuid(n, u) \
+	make_kuid(n, dx_map_uid(from_kuid(n, u)))
+
 static inline gid_t dx_map_gid(gid_t gid)
 {
 	if ((gid > MAX_GID) && (gid != -1))
@@ -120,6 +123,9 @@ static inline gid_t dx_map_gid(gid_t gid
 	return (gid & MAX_GID);
 }
 
+#define	dx_map_kgid(n, u) \
+	make_kgid(n, dx_map_gid(from_kgid(n, u)))
+
 struct peer_tag {
 	int32_t xid;
 	int32_t nid;
diff -NurpP linux-3.9.4-vs2.3.6.1/kernel/vserver/helper.c linux-3.9.4-vs2.3.6.2/kernel/vserver/helper.c
--- linux-3.9.4-vs2.3.6.1/kernel/vserver/helper.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/kernel/vserver/helper.c	2013-06-01 08:27:59.000000000 +0000
@@ -71,7 +71,8 @@ long vs_reboot_helper(struct vx_info *vx
 	snprintf(id_buf, sizeof(id_buf), "%d", vxi->vx_id);
 
 	snprintf(cmd_buf, sizeof(cmd_buf), "VS_CMD=%08x", cmd);
-	snprintf(uid_buf, sizeof(uid_buf), "VS_UID=%d", current_uid());
+	snprintf(uid_buf, sizeof(uid_buf), "VS_UID=%d",
+		from_kuid(&init_user_ns, current_uid()));
 	snprintf(pid_buf, sizeof(pid_buf), "VS_PID=%d", current->pid);
 
 	switch (cmd) {
diff -NurpP linux-3.9.4-vs2.3.6.1/kernel/vserver/inode.c linux-3.9.4-vs2.3.6.2/kernel/vserver/inode.c
--- linux-3.9.4-vs2.3.6.1/kernel/vserver/inode.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/kernel/vserver/inode.c	2013-06-01 08:26:06.000000000 +0000
@@ -167,7 +167,7 @@ static int __vc_set_iattr(struct dentry
 
 	mutex_lock(&in->i_mutex);
 	if (*mask & IATTR_TAG) {
-		attr.ia_tag = *tag;
+		attr.ia_tag = make_ktag(&init_user_ns, *tag);
 		attr.ia_valid |= ATTR_TAG;
 	}
 
diff -NurpP linux-3.9.4-vs2.3.6.1/kernel/vserver/proc.c linux-3.9.4-vs2.3.6.2/kernel/vserver/proc.c
--- linux-3.9.4-vs2.3.6.1/kernel/vserver/proc.c	2013-05-31 14:47:11.000000000 +0000
+++ linux-3.9.4-vs2.3.6.2/kernel/vserver/proc.c	2013-06-01 08:30:38.000000000 +0000
@@ -288,9 +288,9 @@ static struct inode *vs_proc_make_inode(
 
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 
-	inode->i_uid = 0;
-	inode->i_gid = 0;
-	inode->i_tag = 0;
+	i_uid_write(inode, 0);
+	i_gid_write(inode, 0);
+	i_tag_write(inode, 0);
 out:
 	return inode;
 }
