--- linux-2.6.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -275,8 +276,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.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -367,6 +370,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.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -769,6 +774,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; /* Has the inode gone and changed behind our back? */ --- linux-2.6.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -796,10 +804,15 @@ static int nfs_check_inode_attributes(st if (cur_size != new_isize && nfsi->npages == 0) nfsi->cache_validity |= NFS_INO_INVALID_ATTR|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.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -883,6 +896,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.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -955,9 +971,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.18.2/fs/nfs/inode.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/inode.c 2006-09-25 17:21:31 +0200 @@ -962,8 +983,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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfs3xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfs3xdr.c 2006-09-25 17:24:34 +0200 @@ -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.18.2/fs/nfs/nfsroot.c 2006-02-18 14:40:23 +0100 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfsroot.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfs/nfsroot.c 2006-02-18 14:40:23 +0100 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfsroot.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfs/nfsroot.c 2006-02-18 14:40:23 +0100 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfsroot.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfs/nfsroot.c 2006-02-18 14:40:23 +0100 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/nfsroot.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfs/super.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/super.c 2006-09-25 19:20:51 +0200 @@ -367,6 +368,7 @@ static void nfs_show_mount_options(struc { NFS_MOUNT_NOAC, ",noac", "" }, { NFS_MOUNT_NONLM, ",nolock", "" }, { NFS_MOUNT_NOACL, ",noacl", "" }, + { NFS_MOUNT_TAGGED, ",tag", "" }, { 0, NULL, NULL } }; struct proc_nfs_info *nfs_infop; --- linux-2.6.18.2/fs/nfs/super.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/super.c 2006-09-25 19:20:51 +0200 @@ -631,6 +633,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; + nfs_super_set_maxbytes(sb, fsinfo.maxfilesize); server->client->cl_intr = (server->flags & NFS_MOUNT_INTR) ? 1 : 0; --- linux-2.6.18.2/fs/nfs/super.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/super.c 2006-09-25 19:20:51 +0200 @@ -635,6 +640,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.18.2/fs/nfs/super.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfs/super.c 2006-09-25 19:20:51 +0200 @@ -712,6 +718,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.18.2/fs/nfsd/auth.c 2006-06-18 04:54:42 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/auth.c 2006-09-25 15:40:02 +0200 @@ -41,7 +42,7 @@ int nfsd_setuser(struct svc_rqst *rqstp, get_group_info(cred.cr_group_info); 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.18.2/fs/nfsd/auth.c 2006-06-18 04:54:42 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/auth.c 2006-09-25 15:40:02 +0200 @@ -45,7 +46,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.18.2/fs/nfsd/auth.c 2006-06-18 04:54:42 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/auth.c 2006-09-25 15:40:02 +0200 @@ -49,6 +50,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.18.2/fs/nfsd/auth.c 2006-06-18 04:54:42 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/auth.c 2006-09-25 15:40:02 +0200 @@ -53,7 +57,7 @@ ***** return -ENOMEM; ret = set_current_groups(cred.cr_group_info); put_group_info(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.18.2/fs/nfsd/nfs3xdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfs3xdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfs3xdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfs3xdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfs3xdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfs3xdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfs3xdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfs3xdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfs4xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfs4xdr.c 2006-09-25 15:40:02 +0200 @@ -1560,7 +1561,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.18.2/fs/nfsd/nfs4xdr.c 2006-09-20 16:58:35 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfs4xdr.c 2006-09-25 15:40:02 +0200 @@ -1567,7 +1570,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.18.2/fs/nfsd/nfsxdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfsxdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfsxdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfsxdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfsxdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfsxdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/fs/nfsd/nfsxdr.c 2006-04-09 13:49:54 +0200 +++ linux-2.6.18.2-vs2.1.1/fs/nfsd/nfsxdr.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/include/linux/nfs_mount.h 2005-08-29 22:25:42 +0200 +++ linux-2.6.18.2-vs2.1.1/include/linux/nfs_mount.h 2006-09-25 15:40:02 +0200 @@ -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.18.2/include/linux/sunrpc/auth.h 2006-09-20 16:58:44 +0200 +++ linux-2.6.18.2-vs2.1.1/include/linux/sunrpc/auth.h 2006-09-25 15:40:02 +0200 @@ -27,6 +27,7 @@ struct auth_cred { uid_t uid; gid_t gid; + tag_t tag; struct group_info *group_info; }; --- linux-2.6.18.2/include/linux/sunrpc/clnt.h 2006-06-18 04:55:25 +0200 +++ linux-2.6.18.2-vs2.1.1/include/linux/sunrpc/clnt.h 2006-09-25 15:40:02 +0200 @@ -52,7 +52,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.18.2/net/sunrpc/auth.c 2006-06-18 04:55:52 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth.c 2006-09-25 15:40:02 +0200 @@ -263,6 +264,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.18.2/net/sunrpc/auth.c 2006-06-18 04:55:52 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth.c 2006-09-25 15:40:02 +0200 @@ -282,6 +284,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.18.2/net/sunrpc/auth_unix.c 2006-09-20 16:58:54 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth_unix.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/net/sunrpc/auth_unix.c 2006-09-20 16:58:54 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth_unix.c 2006-09-25 15:40:02 +0200 @@ -78,6 +80,7 @@ unx_create_cred(struct rpc_auth *auth, s if (flags & RPCAUTH_LOOKUP_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.18.2/net/sunrpc/auth_unix.c 2006-09-20 16:58:54 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth_unix.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/net/sunrpc/auth_unix.c 2006-09-20 16:58:54 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth_unix.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/net/sunrpc/auth_unix.c 2006-09-20 16:58:54 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth_unix.c 2006-09-25 15:40:02 +0200 @@ -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.18.2/net/sunrpc/auth_unix.c 2006-09-20 16:58:54 +0200 +++ linux-2.6.18.2-vs2.1.1/net/sunrpc/auth_unix.c 2006-09-25 15:40:02 +0200 @@ -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]);