diff options
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
| -rw-r--r-- | fs/nfsd/nfs4xdr.c | 42 | 
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2dcc7feaa6ff..0fbd50cee1f6 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c  | |||
| @@ -1599,7 +1599,8 @@ static __be32 nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, | |||
| 1599 | static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *stat) | 1599 | static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *stat) | 
| 1600 | { | 1600 | { | 
| 1601 | struct svc_fh tmp_fh; | 1601 | struct svc_fh tmp_fh; | 
| 1602 | char *path, *rootpath; | 1602 | char *path = NULL, *rootpath; | 
| 1603 | size_t rootlen; | ||
| 1603 | 1604 | ||
| 1604 | fh_init(&tmp_fh, NFS4_FHSIZE); | 1605 | fh_init(&tmp_fh, NFS4_FHSIZE); | 
| 1605 | *stat = exp_pseudoroot(rqstp, &tmp_fh); | 1606 | *stat = exp_pseudoroot(rqstp, &tmp_fh); | 
| @@ -1609,14 +1610,18 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 * | |||
| 1609 | 1610 | ||
| 1610 | path = exp->ex_pathname; | 1611 | path = exp->ex_pathname; | 
| 1611 | 1612 | ||
| 1612 | if (strncmp(path, rootpath, strlen(rootpath))) { | 1613 | rootlen = strlen(rootpath); | 
| 1614 | if (strncmp(path, rootpath, rootlen)) { | ||
| 1613 | dprintk("nfsd: fs_locations failed;" | 1615 | dprintk("nfsd: fs_locations failed;" | 
| 1614 | "%s is not contained in %s\n", path, rootpath); | 1616 | "%s is not contained in %s\n", path, rootpath); | 
| 1615 | *stat = nfserr_notsupp; | 1617 | *stat = nfserr_notsupp; | 
| 1616 | return NULL; | 1618 | path = NULL; | 
| 1619 | goto out; | ||
| 1617 | } | 1620 | } | 
| 1618 | 1621 | path += rootlen; | |
| 1619 | return path + strlen(rootpath); | 1622 | out: | 
| 1623 | fh_put(&tmp_fh); | ||
| 1624 | return path; | ||
| 1620 | } | 1625 | } | 
| 1621 | 1626 | ||
| 1622 | /* | 1627 | /* | 
| @@ -1793,11 +1798,6 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
| 1793 | goto out_nfserr; | 1798 | goto out_nfserr; | 
| 1794 | } | 1799 | } | 
| 1795 | } | 1800 | } | 
| 1796 | if (bmval0 & FATTR4_WORD0_FS_LOCATIONS) { | ||
| 1797 | if (exp->ex_fslocs.locations == NULL) { | ||
| 1798 | bmval0 &= ~FATTR4_WORD0_FS_LOCATIONS; | ||
| 1799 | } | ||
| 1800 | } | ||
| 1801 | if ((buflen -= 16) < 0) | 1801 | if ((buflen -= 16) < 0) | 
| 1802 | goto out_resource; | 1802 | goto out_resource; | 
| 1803 | 1803 | ||
| @@ -1825,8 +1825,6 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
| 1825 | goto out_resource; | 1825 | goto out_resource; | 
| 1826 | if (!aclsupport) | 1826 | if (!aclsupport) | 
| 1827 | word0 &= ~FATTR4_WORD0_ACL; | 1827 | word0 &= ~FATTR4_WORD0_ACL; | 
| 1828 | if (!exp->ex_fslocs.locations) | ||
| 1829 | word0 &= ~FATTR4_WORD0_FS_LOCATIONS; | ||
| 1830 | if (!word2) { | 1828 | if (!word2) { | 
| 1831 | WRITE32(2); | 1829 | WRITE32(2); | 
| 1832 | WRITE32(word0); | 1830 | WRITE32(word0); | 
| @@ -3064,6 +3062,7 @@ nfsd4_encode_sequence(struct nfsd4_compoundres *resp, int nfserr, | |||
| 3064 | WRITE32(0); | 3062 | WRITE32(0); | 
| 3065 | 3063 | ||
| 3066 | ADJUST_ARGS(); | 3064 | ADJUST_ARGS(); | 
| 3065 | resp->cstate.datap = p; /* DRC cache data pointer */ | ||
| 3067 | return 0; | 3066 | return 0; | 
| 3068 | } | 3067 | } | 
| 3069 | 3068 | ||
| @@ -3166,7 +3165,7 @@ static int nfsd4_check_drc_limit(struct nfsd4_compoundres *resp) | |||
| 3166 | return status; | 3165 | return status; | 
| 3167 | 3166 | ||
| 3168 | session = resp->cstate.session; | 3167 | session = resp->cstate.session; | 
| 3169 | if (session == NULL || slot->sl_cache_entry.ce_cachethis == 0) | 3168 | if (session == NULL || slot->sl_cachethis == 0) | 
| 3170 | return status; | 3169 | return status; | 
| 3171 | 3170 | ||
| 3172 | if (resp->opcnt >= args->opcnt) | 3171 | if (resp->opcnt >= args->opcnt) | 
| @@ -3291,6 +3290,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo | |||
| 3291 | /* | 3290 | /* | 
| 3292 | * All that remains is to write the tag and operation count... | 3291 | * All that remains is to write the tag and operation count... | 
| 3293 | */ | 3292 | */ | 
| 3293 | struct nfsd4_compound_state *cs = &resp->cstate; | ||
| 3294 | struct kvec *iov; | 3294 | struct kvec *iov; | 
| 3295 | p = resp->tagp; | 3295 | p = resp->tagp; | 
| 3296 | *p++ = htonl(resp->taglen); | 3296 | *p++ = htonl(resp->taglen); | 
| @@ -3304,17 +3304,11 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compo | |||
| 3304 | iov = &rqstp->rq_res.head[0]; | 3304 | iov = &rqstp->rq_res.head[0]; | 
| 3305 | iov->iov_len = ((char*)resp->p) - (char*)iov->iov_base; | 3305 | iov->iov_len = ((char*)resp->p) - (char*)iov->iov_base; | 
| 3306 | BUG_ON(iov->iov_len > PAGE_SIZE); | 3306 | BUG_ON(iov->iov_len > PAGE_SIZE); | 
| 3307 | if (nfsd4_has_session(&resp->cstate)) { | 3307 | if (nfsd4_has_session(cs) && cs->status != nfserr_replay_cache) { | 
| 3308 | if (resp->cstate.status == nfserr_replay_cache && | 3308 | nfsd4_store_cache_entry(resp); | 
| 3309 | !nfsd4_not_cached(resp)) { | 3309 | dprintk("%s: SET SLOT STATE TO AVAILABLE\n", __func__); | 
| 3310 | iov->iov_len = resp->cstate.iovlen; | 3310 | resp->cstate.slot->sl_inuse = false; | 
| 3311 | } else { | 3311 | nfsd4_put_session(resp->cstate.session); | 
| 3312 | nfsd4_store_cache_entry(resp); | ||
| 3313 | dprintk("%s: SET SLOT STATE TO AVAILABLE\n", __func__); | ||
| 3314 | resp->cstate.slot->sl_inuse = 0; | ||
| 3315 | } | ||
| 3316 | if (resp->cstate.session) | ||
| 3317 | nfsd4_put_session(resp->cstate.session); | ||
| 3318 | } | 3312 | } | 
| 3319 | return 1; | 3313 | return 1; | 
| 3320 | } | 3314 | } | 
