VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / fs / nfsd / nfsxdr.c
index 6e230b5..77b18ba 100644 (file)
@@ -97,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;
 
@@ -110,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(1, uid, gid);
+       iap->ia_gid = INOXID_GID(1, uid, gid);
+       iap->ia_xid = INOXID_XID(1, uid, gid, 0);
        if ((tmp = ntohl(*p++)) != (u32)-1) {
                iap->ia_valid |= ATTR_SIZE;
                iap->ia_size = tmp;
@@ -162,9 +167,9 @@ encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
        *p++ = htonl((u32) stat.mode);
        *p++ = htonl((u32) stat.nlink);
        *p++ = htonl((u32) nfsd_ruid(rqstp,
-               XIDINO_UID(stat.uid, stat.xid)));
+               XIDINO_UID(XID_TAG(dentry->d_inode), stat.uid, stat.xid)));
        *p++ = htonl((u32) nfsd_rgid(rqstp,
-               XIDINO_GID(stat.gid, stat.xid)));
+               XIDINO_GID(XID_TAG(dentry->d_inode), stat.gid, stat.xid)));
 
        if (S_ISLNK(type) && stat.size > NFS_MAXPATHLEN) {
                *p++ = htonl(NFS_MAXPATHLEN);
@@ -237,7 +242,7 @@ int
 nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd_readargs *args)
 {
-       int len;
+       unsigned int len;
        int v,pn;
        if (!(p = decode_fh(p, &args->fh)))
                return 0;
@@ -258,8 +263,8 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
                svc_take_page(rqstp);
                args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]);
                args->vec[v].iov_len = len < PAGE_SIZE?len:PAGE_SIZE;
+               len -= args->vec[v].iov_len;
                v++;
-               len -= PAGE_SIZE;
        }
        args->vlen = v;
        return xdr_argsize_check(rqstp, p);
@@ -269,7 +274,7 @@ int
 nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd_writeargs *args)
 {
-       int len;
+       unsigned int len;
        int v;
        if (!(p = decode_fh(p, &args->fh)))
                return 0;