--- linux-2.6.11.11/fs/nfs/dir.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/dir.c 2005-06-01 14:34:17 +0200 @@ -739,6 +740,7 @@ static struct dentry *nfs_lookup(struct inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); if (!inode) goto out_unlock; + vx_propagate_xid(nd, inode); no_entry: res = d_add_unique(dentry, inode); if (res != NULL) --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -313,6 +314,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_TAGXID) + sb->s_flags |= MS_TAGXID; + sb->s_maxbytes = fsinfo.maxfilesize; if (sb->s_maxbytes > MAX_LFS_FILESIZE) sb->s_maxbytes = MAX_LFS_FILESIZE; --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -367,6 +371,7 @@ nfs_create_client(struct nfs_server *ser clnt->cl_intr = (server->flags & NFS_MOUNT_INTR) ? 1 : 0; clnt->cl_softrtry = (server->flags & NFS_MOUNT_SOFT) ? 1 : 0; clnt->cl_droppriv = (server->flags & NFS_MOUNT_BROKEN_SUID) ? 1 : 0; + clnt->cl_tagxid = (server->flags & NFS_MOUNT_TAGXID) ? 1 : 0; clnt->cl_chatty = 1; return clnt; --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -539,6 +544,7 @@ static int nfs_show_options(struct seq_f { NFS_MOUNT_NOAC, ",noac", "" }, { NFS_MOUNT_NONLM, ",nolock", ",lock" }, { NFS_MOUNT_BROKEN_SUID, ",broken_suid", "" }, + { NFS_MOUNT_TAGXID, ",tagxid", "" }, { 0, NULL, NULL } }; struct proc_nfs_info *nfs_infop; --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -703,8 +709,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 = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid); + inode->i_gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid); + inode->i_xid = INOXID_XID(XID_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.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -776,6 +789,8 @@ nfs_setattr(struct dentry *dentry, struc inode->i_uid = attr->ia_uid; if ((attr->ia_valid & ATTR_GID) != 0) inode->i_gid = attr->ia_gid; + if ((attr->ia_valid & ATTR_XID) != 0) + inode->i_xid = attr->ia_xid; if ((attr->ia_valid & ATTR_SIZE) != 0) { inode->i_size = attr->ia_size; vmtruncate(inode, attr->ia_size); --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -1123,6 +1138,9 @@ int nfs_refresh_inode(struct inode *inod struct nfs_inode *nfsi = NFS_I(inode); loff_t cur_size, new_isize; int data_unstable; + uid_t uid; + gid_t gid; + xid_t xid = 0; /* Do we hold a delegation? */ if (nfs_have_delegation(inode, FMODE_READ)) --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -1166,10 +1184,15 @@ int nfs_refresh_inode(struct inode *inod } else if (S_ISREG(inode->i_mode) && new_isize > cur_size) nfsi->flags |= NFS_INO_INVALID_ATTR; + uid = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid); + gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid); + xid = INOXID_XID(XID_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_xid != xid) nfsi->flags |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; /* Has the link count changed? */ --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -1203,6 +1226,9 @@ static int nfs_update_inode(struct inode unsigned int invalid = 0; loff_t cur_isize; int data_unstable; + uid_t uid; + gid_t gid; + xid_t xid = 0; dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", __FUNCTION__, inode->i_sb->s_id, inode->i_ino, --- linux-2.6.11.11/fs/nfs/inode.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/inode.c 2005-06-01 14:34:17 +0200 @@ -1285,15 +1311,21 @@ static int nfs_update_inode(struct inode memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); + uid = INOXID_UID(XID_TAG(inode), fattr->uid, fattr->gid); + gid = INOXID_GID(XID_TAG(inode), fattr->uid, fattr->gid); + xid = INOXID_XID(XID_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_xid != xid) invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; 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_xid = xid; if (fattr->valid & (NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4)) { /* --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -173,7 +174,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 tagxid) { if (attr->ia_valid & ATTR_MODE) { *p++ = xdr_one; --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -181,15 +182,17 @@ xdr_encode_sattr(u32 *p, struct iattr *a } else { *p++ = xdr_zero; } - if (attr->ia_valid & ATTR_UID) { + if (attr->ia_valid & ATTR_UID || + (tagxid && (attr->ia_valid & ATTR_XID))) { *p++ = xdr_one; - *p++ = htonl(attr->ia_uid); + *p++ = htonl(XIDINO_UID(tagxid, attr->ia_uid, attr->ia_xid)); } else { *p++ = xdr_zero; } - if (attr->ia_valid & ATTR_GID) { + if (attr->ia_valid & ATTR_GID || + (tagxid && (attr->ia_valid & ATTR_XID))) { *p++ = xdr_one; - *p++ = htonl(attr->ia_gid); + *p++ = htonl(XIDINO_GID(tagxid, attr->ia_gid, attr->ia_xid)); } else { *p++ = xdr_zero; } --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -274,7 +277,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_tagxid); *p++ = htonl(args->guard); if (args->guard) p = xdr_encode_time3(p, &args->guardtime); --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -365,7 +369,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_tagxid); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -379,7 +384,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_tagxid); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; } --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -392,7 +398,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_tagxid); p = xdr_encode_array(p, args->topath, args->tolen); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; --- linux-2.6.11.11/fs/nfs/nfs3xdr.c 2004-10-23 05:06:17 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -407,7 +414,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_tagxid); if (args->type == NF3CHR || args->type == NF3BLK) { *p++ = htonl(MAJOR(args->rdev)); *p++ = htonl(MINOR(args->rdev)); --- linux-2.6.11.11/fs/nfs/nfsroot.c 2004-08-14 12:55:48 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfsroot.c 2005-06-01 14:34:17 +0200 @@ -124,7 +125,7 @@ enum { 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_broken_suid, + Opt_broken_suid, Opt_tagxid, /* Error token */ Opt_err }; --- linux-2.6.11.11/fs/nfs/nfsroot.c 2004-08-14 12:55:48 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfsroot.c 2005-06-01 14:34:17 +0200 @@ -160,6 +161,7 @@ static match_table_t __initdata tokens = {Opt_tcp, "proto=tcp"}, {Opt_tcp, "tcp"}, {Opt_broken_suid, "broken_suid"}, + {Opt_tagxid, "tagxid"}, {Opt_err, NULL} }; --- linux-2.6.11.11/fs/nfs/nfsroot.c 2004-08-14 12:55:48 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfs/nfsroot.c 2005-06-01 14:34:17 +0200 @@ -271,6 +273,9 @@ static int __init root_nfs_parse(char *n case Opt_broken_suid: nfs_data.flags |= NFS_MOUNT_BROKEN_SUID; break; + case Opt_tagxid: + nfs_data.flags |= NFS_MOUNT_TAGXID; + break; default : return 0; } --- linux-2.6.11.11/fs/nfsd/auth.c 2004-08-14 12:56:14 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/auth.c 2005-06-01 14:34:17 +0200 @@ -42,18 +43,20 @@ int nfsd_setuser(struct svc_rqst *rqstp, } if (cred->cr_uid != (uid_t) -1) - current->fsuid = cred->cr_uid; + current->fsuid = INOXID_UID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid); else current->fsuid = exp->ex_anon_uid; if (cred->cr_gid != (gid_t) -1) - current->fsgid = cred->cr_gid; + current->fsgid = INOXID_GID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid); else current->fsgid = exp->ex_anon_gid; + current->xid = INOXID_XID(XID_TAG_NFSD, cred->cr_uid, cred->cr_gid, 0); + if (!cred->cr_group_info) return -ENOMEM; ret = set_current_groups(cred->cr_group_info); - if ((cred->cr_uid)) { + if (INOXID_UID(XID_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.11.11/fs/nfsd/nfs3xdr.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -105,6 +106,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.11.11/fs/nfsd/nfs3xdr.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -114,12 +117,15 @@ 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; - iap->ia_gid = ntohl(*p++); + gid = ntohl(*p++); } + iap->ia_uid = INOXID_UID(XID_TAG_NFSD, uid, gid); + iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid); + iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0); if (*p++) { u64 newsize; --- linux-2.6.11.11/fs/nfsd/nfs3xdr.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfs3xdr.c 2005-06-01 14:34:17 +0200 @@ -160,8 +166,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, + XIDINO_UID(XID_TAG(dentry->d_inode), stat.uid, stat.xid))); + *p++ = htonl((u32) nfsd_rgid(rqstp, + XIDINO_GID(XID_TAG(dentry->d_inode), stat.gid, stat.xid))); if (S_ISLNK(stat.mode) && stat.size > NFS3_MAXPATHLEN) { p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN); } else { --- linux-2.6.11.11/fs/nfsd/nfs4xdr.c 2005-03-02 12:38:45 +0100 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfs4xdr.c 2005-06-01 14:34:17 +0200 @@ -1680,14 +1681,18 @@ out_acl: WRITE32(stat.nlink); } if (bmval1 & FATTR4_WORD1_OWNER) { - status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen); + status = nfsd4_encode_user(rqstp, + XIDINO_UID(XID_TAG(dentry->d_inode), + stat.uid, stat.xid), &p, &buflen); if (status == nfserr_resource) goto out_resource; if (status) goto out; } if (bmval1 & FATTR4_WORD1_OWNER_GROUP) { - status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen); + status = nfsd4_encode_group(rqstp, + XIDINO_GID(XID_TAG(dentry->d_inode), + stat.gid, stat.xid), &p, &buflen); if (status == nfserr_resource) goto out_resource; if (status) --- linux-2.6.11.11/fs/nfsd/nfsxdr.c 2004-08-14 12:54:47 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfsxdr.c 2005-06-01 14:34:17 +0200 @@ -96,6 +97,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.11.11/fs/nfsd/nfsxdr.c 2004-08-14 12:54:47 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfsxdr.c 2005-06-01 14:34:17 +0200 @@ -109,12 +112,15 @@ 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; - iap->ia_gid = tmp; + gid = tmp; } + iap->ia_uid = INOXID_UID(XID_TAG_NFSD, uid, gid); + iap->ia_gid = INOXID_GID(XID_TAG_NFSD, uid, gid); + iap->ia_xid = INOXID_XID(XID_TAG_NFSD, uid, gid, 0); if ((tmp = ntohl(*p++)) != (u32)-1) { iap->ia_valid |= ATTR_SIZE; iap->ia_size = tmp; --- linux-2.6.11.11/fs/nfsd/nfsxdr.c 2004-08-14 12:54:47 +0200 +++ linux-2.6.11.11-vs2.0-rc3/fs/nfsd/nfsxdr.c 2005-06-01 14:34:17 +0200 @@ -160,8 +166,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, + XIDINO_UID(XID_TAG(dentry->d_inode), stat.uid, stat.xid))); + *p++ = htonl((u32) nfsd_rgid(rqstp, + XIDINO_GID(XID_TAG(dentry->d_inode), stat.gid, stat.xid))); if (S_ISLNK(type) && stat.size > NFS_MAXPATHLEN) { *p++ = htonl(NFS_MAXPATHLEN); --- linux-2.6.11.11/include/linux/nfs_mount.h 2004-08-14 12:54:47 +0200 +++ linux-2.6.11.11-vs2.0-rc3/include/linux/nfs_mount.h 2005-06-01 14:34:17 +0200 @@ -60,6 +60,7 @@ struct nfs_mount_data { #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ #define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ +#define NFS_MOUNT_TAGXID 0x8000 /* tagxid */ #define NFS_MOUNT_FLAGMASK 0xFFFF #endif --- linux-2.6.11.11/include/linux/sunrpc/auth.h 2005-03-02 12:38:53 +0100 +++ linux-2.6.11.11-vs2.0-rc3/include/linux/sunrpc/auth.h 2005-06-01 14:34:17 +0200 @@ -28,6 +28,7 @@ struct auth_cred { uid_t uid; gid_t gid; + xid_t xid; struct group_info *group_info; }; --- linux-2.6.11.11/include/linux/sunrpc/clnt.h 2004-08-14 12:55:34 +0200 +++ linux-2.6.11.11-vs2.0-rc3/include/linux/sunrpc/clnt.h 2005-06-01 14:34:17 +0200 @@ -53,7 +53,8 @@ struct rpc_clnt { cl_autobind : 1,/* use getport() */ cl_droppriv : 1,/* enable NFS suid hack */ cl_oneshot : 1,/* dispose after use */ - cl_dead : 1;/* abandoned */ + cl_dead : 1,/* abandoned */ + cl_tagxid : 1;/* do xid tagging */ struct rpc_rtt * cl_rtt; /* RTO estimator data */ struct rpc_portmap * cl_pmap; /* port mapping */ --- linux-2.6.11.11/net/sunrpc/auth.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth.c 2005-06-01 14:34:17 +0200 @@ -259,6 +260,7 @@ rpcauth_lookupcred(struct rpc_auth *auth get_group_info(current->group_info); acred.uid = current->fsuid; acred.gid = current->fsgid; + acred.xid = vx_current_xid(); acred.group_info = current->group_info; dprintk("RPC: looking up %s cred\n", --- linux-2.6.11.11/net/sunrpc/auth.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth.c 2005-06-01 14:34:17 +0200 @@ -278,6 +280,7 @@ rpcauth_bindcred(struct rpc_task *task) get_group_info(current->group_info); acred.uid = current->fsuid; acred.gid = current->fsgid; + acred.xid = vx_current_xid(); acred.group_info = current->group_info; dprintk("RPC: %4d looking up %s cred\n", --- linux-2.6.11.11/net/sunrpc/auth_unix.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth_unix.c 2005-06-01 14:34:17 +0200 @@ -13,14 +13,17 @@ #include #include #include +#include #define NFS_NGROUPS 16 struct unx_cred { struct rpc_cred uc_base; gid_t uc_gid; + xid_t uc_xid; uid_t uc_puid; /* process uid */ gid_t uc_pgid; /* process gid */ + xid_t uc_pxid; /* process xid */ gid_t uc_gids[NFS_NGROUPS]; }; #define uc_uid uc_base.cr_uid --- linux-2.6.11.11/net/sunrpc/auth_unix.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth_unix.c 2005-06-01 14:34:17 +0200 @@ -80,6 +83,7 @@ unx_create_cred(struct rpc_auth *auth, s if (flags & RPC_TASK_ROOTCREDS) { cred->uc_uid = cred->uc_puid = 0; cred->uc_gid = cred->uc_pgid = 0; + cred->uc_xid = cred->uc_pxid = vx_current_xid(); cred->uc_gids[0] = NOGROUP; } else { int groups = acred->group_info->ngroups; --- linux-2.6.11.11/net/sunrpc/auth_unix.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth_unix.c 2005-06-01 14:34:17 +0200 @@ -88,8 +92,10 @@ unx_create_cred(struct rpc_auth *auth, s cred->uc_uid = acred->uid; cred->uc_gid = acred->gid; + cred->uc_xid = acred->xid; cred->uc_puid = current->uid; cred->uc_pgid = current->gid; + cred->uc_pxid = vx_current_xid(); for (i = 0; i < groups; i++) cred->uc_gids[i] = GROUP_AT(acred->group_info, i); if (i < NFS_NGROUPS) --- linux-2.6.11.11/net/sunrpc/auth_unix.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth_unix.c 2005-06-01 14:34:17 +0200 @@ -122,8 +128,10 @@ unx_match(struct auth_cred *acred, struc if (cred->uc_uid != acred->uid || cred->uc_gid != acred->gid + || cred->uc_xid != acred->xid || cred->uc_puid != current->uid - || cred->uc_pgid != current->gid) + || cred->uc_pgid != current->gid + || cred->uc_pxid != vx_current_xid()) return 0; groups = acred->group_info->ngroups; --- linux-2.6.11.11/net/sunrpc/auth_unix.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth_unix.c 2005-06-01 14:34:17 +0200 @@ -149,7 +157,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, tagxid; *p++ = htonl(RPC_AUTH_UNIX); base = p++; --- linux-2.6.11.11/net/sunrpc/auth_unix.c 2005-03-02 12:39:11 +0100 +++ linux-2.6.11.11-vs2.0-rc3/net/sunrpc/auth_unix.c 2005-06-01 14:34:17 +0200 @@ -159,14 +167,19 @@ 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); + tagxid = task->tk_client->cl_tagxid; /* Note: we don't use real uid if it involves raising privilege */ if (ruid && cred->uc_puid != 0 && cred->uc_pgid != 0) { - *p++ = htonl((u32) cred->uc_puid); - *p++ = htonl((u32) cred->uc_pgid); + *p++ = htonl((u32) XIDINO_UID(tagxid, + cred->uc_puid, cred->uc_pxid)); + *p++ = htonl((u32) XIDINO_GID(tagxid, + cred->uc_pgid, cred->uc_pxid)); } else { - *p++ = htonl((u32) cred->uc_uid); - *p++ = htonl((u32) cred->uc_gid); + *p++ = htonl((u32) XIDINO_UID(tagxid, + cred->uc_uid, cred->uc_xid)); + *p++ = htonl((u32) XIDINO_GID(tagxid, + cred->uc_gid, cred->uc_xid)); } hold = p++; for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)