--- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -336,6 +337,9 @@ nfs_sb_init(struct super_block *sb, rpc_ } server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD; + if (server->flags & NFS_MOUNT_TAGGED) + sb->s_flags |= MS_TAGGED; + sb->s_maxbytes = fsinfo.maxfilesize; if (sb->s_maxbytes > MAX_LFS_FILESIZE) sb->s_maxbytes = MAX_LFS_FILESIZE; --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -342,6 +346,7 @@ ***** server->client->cl_intr = (server->flags & NFS_MOUNT_INTR) ? 1 : 0; server->client->cl_softrtry = (server->flags & NFS_MOUNT_SOFT) ? 1 : 0; + server->client->cl_tag = (server->flags & NFS_MOUNT_TAGGED) ? 1 : 0; /* We're airborne Set socket buffersize */ rpc_setbufsize(server->client, server->wsize + 100, server->rsize + 100); --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -413,6 +418,7 @@ nfs_create_client(struct nfs_server *ser clnt->cl_intr = 1; clnt->cl_softrtry = 1; + clnt->cl_tag = 1; return clnt; --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -593,6 +599,7 @@ static int nfs_show_options(struct seq_f { NFS_MOUNT_NOAC, ",noac", "" }, { NFS_MOUNT_NONLM, ",nolock", ",lock" }, { NFS_MOUNT_NOACL, ",noacl", "" }, + { NFS_MOUNT_TAGGED, ",tag", "" }, { 0, NULL, NULL } }; struct proc_nfs_info *nfs_infop; --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -805,8 +812,10 @@ nfs_fhget(struct super_block *sb, struct nfsi->change_attr = fattr->change_attr; inode->i_size = nfs_size_to_loff_t(fattr->size); inode->i_nlink = fattr->nlink; - inode->i_uid = fattr->uid; - inode->i_gid = fattr->gid; + inode->i_uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid); + inode->i_gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid); + inode->i_tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0); + /* maybe fattr->xid someday */ if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { /* * report the blocks in 512byte units --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -897,6 +906,8 @@ void nfs_setattr_update_inode(struct ino inode->i_uid = attr->ia_uid; if ((attr->ia_valid & ATTR_GID) != 0) inode->i_gid = attr->ia_gid; + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode)) + inode->i_tag = attr->ia_tag; spin_lock(&inode->i_lock); NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; spin_unlock(&inode->i_lock); --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -1294,6 +1305,9 @@ static int nfs_check_inode_attributes(st struct nfs_inode *nfsi = NFS_I(inode); loff_t cur_size, new_isize; int data_unstable; + uid_t uid; + gid_t gid; + tag_t tag; if ((fattr->valid & NFS_ATTR_FATTR) == 0) --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -1333,10 +1347,15 @@ static int nfs_check_inode_attributes(st nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE; } + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid); + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid); + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0); + /* Have any file permissions changed? */ if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) - || inode->i_uid != fattr->uid - || inode->i_gid != fattr->gid) + || inode->i_uid != uid + || inode->i_gid != gid + || inode->i_tag != tag) nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; /* Has the link count changed? */ --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -1420,6 +1439,9 @@ static int nfs_update_inode(struct inode loff_t cur_isize, new_isize; unsigned int invalid = 0; int data_stable; + uid_t uid; + gid_t gid; + tag_t tag; dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", __FUNCTION__, inode->i_sb->s_id, inode->i_ino, --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -1498,9 +1520,14 @@ static int nfs_update_inode(struct inode } memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid); + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid); + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0); + if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) || - inode->i_uid != fattr->uid || - inode->i_gid != fattr->gid) + inode->i_uid != uid || + inode->i_gid != gid || + inode->i_tag != tag) invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; inode->i_mode = fattr->mode; --- linux-2.6.16-rc1/fs/nfs/inode.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/inode.c 2006-01-28 03:39:34 +0100 @@ -1505,8 +1532,9 @@ ***** inode->i_mode = fattr->mode; inode->i_nlink = fattr->nlink; - inode->i_uid = fattr->uid; - inode->i_gid = fattr->gid; + inode->i_uid = uid; + inode->i_gid = gid; + inode->i_tag = tag; if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { /* --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -178,7 +179,7 @@ xdr_decode_fattr(u32 *p, struct nfs_fatt } static inline u32 * -xdr_encode_sattr(u32 *p, struct iattr *attr) +xdr_encode_sattr(u32 *p, struct iattr *attr, int tag) { if (attr->ia_valid & ATTR_MODE) { *p++ = xdr_one; --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -186,9 +187,10 @@ xdr_encode_sattr(u32 *p, struct iattr *a } else { *p++ = xdr_zero; } - if (attr->ia_valid & ATTR_UID) { + if (attr->ia_valid & ATTR_UID || + (tag && (attr->ia_valid & ATTR_TAG))) { *p++ = xdr_one; - *p++ = htonl(attr->ia_uid); + *p++ = htonl(TAGINO_UID(tag, attr->ia_uid, attr->ia_tag)); } else { *p++ = xdr_zero; } --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -192,9 +194,10 @@ ***** } else { *p++ = xdr_zero; } - if (attr->ia_valid & ATTR_GID) { + if (attr->ia_valid & ATTR_GID || + (tag && (attr->ia_valid & ATTR_TAG))) { *p++ = xdr_one; - *p++ = htonl(attr->ia_gid); + *p++ = htonl(TAGINO_GID(tag, attr->ia_gid, attr->ia_tag)); } else { *p++ = xdr_zero; } --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -279,7 +282,8 @@ static int nfs3_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs3_sattrargs *args) { p = xdr_encode_fhandle(p, args->fh); - p = xdr_encode_sattr(p, args->sattr); + p = xdr_encode_sattr(p, args->sattr, + req->rq_task->tk_client->cl_tag); *p++ = htonl(args->guard); if (args->guard) p = xdr_encode_time3(p, &args->guardtime); --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -370,7 +374,8 @@ nfs3_xdr_createargs(struct rpc_rqst *req *p++ = args->verifier[0]; *p++ = args->verifier[1]; } else - p = xdr_encode_sattr(p, args->sattr); + p = xdr_encode_sattr(p, args->sattr, + req->rq_task->tk_client->cl_tag); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -384,7 +389,8 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req, { p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_array(p, args->name, args->len); - p = xdr_encode_sattr(p, args->sattr); + p = xdr_encode_sattr(p, args->sattr, + req->rq_task->tk_client->cl_tag); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; } --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -397,7 +403,8 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *re { p = xdr_encode_fhandle(p, args->fromfh); p = xdr_encode_array(p, args->fromname, args->fromlen); - p = xdr_encode_sattr(p, args->sattr); + p = xdr_encode_sattr(p, args->sattr, + req->rq_task->tk_client->cl_tag); p = xdr_encode_array(p, args->topath, args->tolen); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; --- linux-2.6.16-rc1/fs/nfs/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfs3xdr.c 2006-01-25 05:34:51 +0100 @@ -412,7 +419,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_array(p, args->name, args->len); *p++ = htonl(args->type); - p = xdr_encode_sattr(p, args->sattr); + p = xdr_encode_sattr(p, args->sattr, + req->rq_task->tk_client->cl_tag); if (args->type == NF3CHR || args->type == NF3BLK) { *p++ = htonl(MAJOR(args->rdev)); *p++ = htonl(MINOR(args->rdev)); --- linux-2.6.16-rc1/fs/nfs/nfsroot.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfsroot.c 2006-01-25 08:06:16 +0100 @@ -119,7 +120,7 @@ static int mount_port __initdata = 0; / enum { /* Options that take integer arguments */ Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin, - Opt_acregmax, Opt_acdirmin, Opt_acdirmax, + Opt_acregmax, Opt_acdirmin, Opt_acdirmax, Opt_tagid, /* Options that take no arguments */ Opt_soft, Opt_hard, Opt_intr, Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac, --- linux-2.6.16-rc1/fs/nfs/nfsroot.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfsroot.c 2006-01-25 08:06:16 +0100 @@ -124,7 +125,7 @@ ***** Opt_soft, Opt_hard, Opt_intr, Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac, Opt_noac, Opt_lock, Opt_nolock, Opt_v2, Opt_v3, Opt_udp, Opt_tcp, - Opt_acl, Opt_noacl, + Opt_acl, Opt_noacl, Opt_tag, Opt_notag, /* Error token */ Opt_err }; --- linux-2.6.16-rc1/fs/nfs/nfsroot.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfsroot.c 2006-01-25 08:06:16 +0100 @@ -161,6 +162,10 @@ static match_table_t __initdata tokens = {Opt_tcp, "tcp"}, {Opt_acl, "acl"}, {Opt_noacl, "noacl"}, + {Opt_tag, "tag"}, + {Opt_notag, "notag"}, + {Opt_tagid, "tagid=%u"}, + {Opt_tag, "tagxid"}, {Opt_err, NULL} }; --- linux-2.6.16-rc1/fs/nfs/nfsroot.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfs/nfsroot.c 2006-01-25 08:06:16 +0100 @@ -275,6 +280,20 @@ static int __init root_nfs_parse(char *n case Opt_noacl: nfs_data.flags |= NFS_MOUNT_NOACL; break; +#ifndef CONFIG_TAGGING_NONE + case Opt_tag: + nfs_data.flags |= NFS_MOUNT_TAGGED; + break; + case Opt_notag: + nfs_data.flags &= ~NFS_MOUNT_TAGGED; + break; +#endif +#ifdef CONFIG_PROPAGATE + case Opt_tagid: + /* use args[0] */ + nfs_data.flags |= NFS_MOUNT_TAGGED; + break; +#endif default: printk(KERN_WARNING "Root-NFS: unknown " "option: %s\n", p); --- linux-2.6.16-rc1/fs/nfsd/auth.c 2004-08-14 12:56:14 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/auth.c 2006-01-28 03:25:59 +0100 @@ -42,7 +43,7 @@ int nfsd_setuser(struct svc_rqst *rqstp, } if (cred->cr_uid != (uid_t) -1) - current->fsuid = cred->cr_uid; + current->fsuid = INOTAG_UID(DX_TAG_NFSD, cred->cr_uid, cred->cr_gid); else current->fsuid = exp->ex_anon_uid; if (cred->cr_gid != (gid_t) -1) --- linux-2.6.16-rc1/fs/nfsd/auth.c 2004-08-14 12:56:14 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/auth.c 2006-01-28 03:25:59 +0100 @@ -46,7 +47,7 @@ ***** else current->fsuid = exp->ex_anon_uid; if (cred->cr_gid != (gid_t) -1) - current->fsgid = cred->cr_gid; + current->fsgid = INOTAG_GID(DX_TAG_NFSD, cred->cr_uid, cred->cr_gid); else current->fsgid = exp->ex_anon_gid; --- linux-2.6.16-rc1/fs/nfsd/auth.c 2004-08-14 12:56:14 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/auth.c 2006-01-28 03:25:59 +0100 @@ -50,6 +51,9 @@ ***** else current->fsgid = exp->ex_anon_gid; + /* this desperately needs a tag :) */ + current->xid = (xid_t)INOTAG_TAG(DX_TAG_NFSD, cred->cr_uid, cred->cr_gid, 0); + if (!cred->cr_group_info) return -ENOMEM; ret = set_current_groups(cred->cr_group_info); --- linux-2.6.16-rc1/fs/nfsd/auth.c 2004-08-14 12:56:14 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/auth.c 2006-01-28 03:25:59 +0100 @@ -53,7 +57,7 @@ ***** if (!cred->cr_group_info) return -ENOMEM; ret = set_current_groups(cred->cr_group_info); - if ((cred->cr_uid)) { + if (INOTAG_UID(DX_TAG_NFSD, cred->cr_uid, cred->cr_gid)) { cap_t(current->cap_effective) &= ~CAP_NFSD_MASK; } else { cap_t(current->cap_effective) |= (CAP_NFSD_MASK & --- linux-2.6.16-rc1/fs/nfsd/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfs3xdr.c 2006-01-28 03:41:08 +0100 @@ -111,6 +112,8 @@ static inline u32 * decode_sattr3(u32 *p, struct iattr *iap) { u32 tmp; + uid_t uid = 0; + gid_t gid = 0; iap->ia_valid = 0; --- linux-2.6.16-rc1/fs/nfsd/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfs3xdr.c 2006-01-28 03:41:08 +0100 @@ -120,7 +123,7 @@ decode_sattr3(u32 *p, struct iattr *iap) } if (*p++) { iap->ia_valid |= ATTR_UID; - iap->ia_uid = ntohl(*p++); + uid = ntohl(*p++); } if (*p++) { iap->ia_valid |= ATTR_GID; --- linux-2.6.16-rc1/fs/nfsd/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfs3xdr.c 2006-01-28 03:41:08 +0100 @@ -124,8 +127,11 @@ ***** } if (*p++) { iap->ia_valid |= ATTR_GID; - iap->ia_gid = ntohl(*p++); + gid = ntohl(*p++); } + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid); + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid); + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0); if (*p++) { u64 newsize; --- linux-2.6.16-rc1/fs/nfsd/nfs3xdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfs3xdr.c 2006-01-28 03:41:08 +0100 @@ -163,8 +169,10 @@ encode_fattr3(struct svc_rqst *rqstp, u3 *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]); *p++ = htonl((u32) stat->mode); *p++ = htonl((u32) stat->nlink); - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid)); - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid)); + *p++ = htonl((u32) nfsd_ruid(rqstp, + TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag))); + *p++ = htonl((u32) nfsd_rgid(rqstp, + TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag))); if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) { p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN); } else { --- linux-2.6.16-rc1/fs/nfsd/nfs4xdr.c 2006-01-03 17:29:58 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfs4xdr.c 2006-01-28 03:28:35 +0100 @@ -1561,7 +1562,9 @@ out_acl: WRITE32(stat.nlink); } if (bmval1 & FATTR4_WORD1_OWNER) { - status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen); + status = nfsd4_encode_user(rqstp, + TAGINO_UID(DX_TAG(dentry->d_inode), + stat.uid, stat.tag), &p, &buflen); if (status == nfserr_resource) goto out_resource; if (status) --- linux-2.6.16-rc1/fs/nfsd/nfs4xdr.c 2006-01-03 17:29:58 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfs4xdr.c 2006-01-28 03:28:35 +0100 @@ -1568,7 +1571,9 @@ ***** goto out; } if (bmval1 & FATTR4_WORD1_OWNER_GROUP) { - status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen); + status = nfsd4_encode_group(rqstp, + TAGINO_GID(DX_TAG(dentry->d_inode), + stat.gid, stat.tag), &p, &buflen); if (status == nfserr_resource) goto out_resource; if (status) --- linux-2.6.16-rc1/fs/nfsd/nfsxdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfsxdr.c 2006-01-28 03:29:28 +0100 @@ -102,6 +103,8 @@ static inline u32 * decode_sattr(u32 *p, struct iattr *iap) { u32 tmp, tmp1; + uid_t uid = 0; + gid_t gid = 0; iap->ia_valid = 0; --- linux-2.6.16-rc1/fs/nfsd/nfsxdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfsxdr.c 2006-01-28 03:29:28 +0100 @@ -115,7 +118,7 @@ decode_sattr(u32 *p, struct iattr *iap) } if ((tmp = ntohl(*p++)) != (u32)-1) { iap->ia_valid |= ATTR_UID; - iap->ia_uid = tmp; + uid = tmp; } if ((tmp = ntohl(*p++)) != (u32)-1) { iap->ia_valid |= ATTR_GID; --- linux-2.6.16-rc1/fs/nfsd/nfsxdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfsxdr.c 2006-01-28 03:29:28 +0100 @@ -119,8 +122,11 @@ ***** } if ((tmp = ntohl(*p++)) != (u32)-1) { iap->ia_valid |= ATTR_GID; - iap->ia_gid = tmp; + gid = tmp; } + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid); + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid); + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0); if ((tmp = ntohl(*p++)) != (u32)-1) { iap->ia_valid |= ATTR_SIZE; iap->ia_size = tmp; --- linux-2.6.16-rc1/fs/nfsd/nfsxdr.c 2006-01-26 22:35:12 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/fs/nfsd/nfsxdr.c 2006-01-28 03:29:28 +0100 @@ -164,8 +170,10 @@ encode_fattr(struct svc_rqst *rqstp, u32 *p++ = htonl(nfs_ftypes[type >> 12]); *p++ = htonl((u32) stat->mode); *p++ = htonl((u32) stat->nlink); - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid)); - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid)); + *p++ = htonl((u32) nfsd_ruid(rqstp, + TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag))); + *p++ = htonl((u32) nfsd_rgid(rqstp, + TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag))); if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) { *p++ = htonl(NFS_MAXPATHLEN); --- linux-2.6.16-rc1/include/linux/nfs_mount.h 2005-08-29 22:25:42 +0200 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/nfs_mount.h 2006-01-25 05:34:51 +0100 @@ -61,6 +61,7 @@ struct nfs_mount_data { #define NFS_MOUNT_NOACL 0x0800 /* 4 */ #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ +#define NFS_MOUNT_TAGGED 0x8000 /* context tagging */ #define NFS_MOUNT_FLAGMASK 0xFFFF #endif --- linux-2.6.16-rc1/include/linux/sunrpc/auth.h 2006-01-03 17:30:10 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/sunrpc/auth.h 2006-01-28 04:03:30 +0100 @@ -28,6 +28,7 @@ struct auth_cred { uid_t uid; gid_t gid; + tag_t tag; struct group_info *group_info; }; --- linux-2.6.16-rc1/include/linux/sunrpc/clnt.h 2006-01-26 22:35:20 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/include/linux/sunrpc/clnt.h 2006-01-25 05:34:51 +0100 @@ -51,7 +51,8 @@ struct rpc_clnt { cl_intr : 1,/* interruptible */ cl_autobind : 1,/* use getport() */ cl_oneshot : 1,/* dispose after use */ - cl_dead : 1;/* abandoned */ + cl_dead : 1,/* abandoned */ + cl_tag : 1;/* context tagging */ struct rpc_rtt * cl_rtt; /* RTO estimator data */ struct rpc_portmap * cl_pmap; /* port mapping */ --- linux-2.6.16-rc1/net/sunrpc/auth.c 2006-01-26 22:35:39 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth.c 2006-01-28 04:05:47 +0100 @@ -243,6 +244,7 @@ rpcauth_lookupcred(struct rpc_auth *auth struct auth_cred acred = { .uid = current->fsuid, .gid = current->fsgid, + .tag = dx_current_tag(), .group_info = current->group_info, }; struct rpc_cred *ret; --- linux-2.6.16-rc1/net/sunrpc/auth.c 2006-01-26 22:35:39 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth.c 2006-01-28 04:05:47 +0100 @@ -262,6 +264,7 @@ rpcauth_bindcred(struct rpc_task *task) struct auth_cred acred = { .uid = current->fsuid, .gid = current->fsgid, + .tag = dx_current_tag(), .group_info = current->group_info, }; struct rpc_cred *ret; --- linux-2.6.16-rc1/net/sunrpc/auth_unix.c 2006-01-26 22:35:40 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth_unix.c 2006-01-28 04:09:56 +0100 @@ -17,6 +18,7 @@ ***** struct unx_cred { struct rpc_cred uc_base; gid_t uc_gid; + tag_t uc_tag; gid_t uc_gids[NFS_NGROUPS]; }; #define uc_uid uc_base.cr_uid --- linux-2.6.16-rc1/net/sunrpc/auth_unix.c 2006-01-26 22:35:40 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth_unix.c 2006-01-28 04:09:56 +0100 @@ -78,6 +80,7 @@ unx_create_cred(struct rpc_auth *auth, s if (flags & RPC_TASK_ROOTCREDS) { cred->uc_uid = 0; cred->uc_gid = 0; + cred->uc_tag = dx_current_tag(); cred->uc_gids[0] = NOGROUP; } else { int groups = acred->group_info->ngroups; --- linux-2.6.16-rc1/net/sunrpc/auth_unix.c 2006-01-26 22:35:40 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth_unix.c 2006-01-28 04:09:56 +0100 @@ -86,6 +89,7 @@ unx_create_cred(struct rpc_auth *auth, s cred->uc_uid = acred->uid; cred->uc_gid = acred->gid; + cred->uc_tag = acred->tag; for (i = 0; i < groups; i++) cred->uc_gids[i] = GROUP_AT(acred->group_info, i); if (i < NFS_NGROUPS) --- linux-2.6.16-rc1/net/sunrpc/auth_unix.c 2006-01-26 22:35:40 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth_unix.c 2006-01-28 04:09:56 +0100 @@ -117,7 +121,8 @@ unx_match(struct auth_cred *acred, struc int groups; if (cred->uc_uid != acred->uid - || cred->uc_gid != acred->gid) + || cred->uc_gid != acred->gid + || cred->uc_tag != acred->tag) return 0; groups = acred->group_info->ngroups; --- linux-2.6.16-rc1/net/sunrpc/auth_unix.c 2006-01-26 22:35:40 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth_unix.c 2006-01-28 04:09:56 +0100 @@ -143,7 +148,7 @@ unx_marshal(struct rpc_task *task, u32 * struct rpc_clnt *clnt = task->tk_client; struct unx_cred *cred = (struct unx_cred *) task->tk_msg.rpc_cred; u32 *base, *hold; - int i; + int i, tag; *p++ = htonl(RPC_AUTH_UNIX); base = p++; --- linux-2.6.16-rc1/net/sunrpc/auth_unix.c 2006-01-26 22:35:40 +0100 +++ linux-2.6.16-rc1-vs2.1.0.9.4/net/sunrpc/auth_unix.c 2006-01-28 04:09:56 +0100 @@ -153,9 +158,12 @@ unx_marshal(struct rpc_task *task, u32 * * Copy the UTS nodename captured when the client was created. */ p = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen); + tag = task->tk_client->cl_tag; - *p++ = htonl((u32) cred->uc_uid); - *p++ = htonl((u32) cred->uc_gid); + *p++ = htonl((u32) TAGINO_UID(tag, + cred->uc_uid, cred->uc_tag)); + *p++ = htonl((u32) TAGINO_GID(tag, + cred->uc_gid, cred->uc_tag)); hold = p++; for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++) *p++ = htonl((u32) cred->uc_gids[i]);