Hello,
I've fixed a problem that NFSv2 won't work when NFSv2 procedure
handler (proc->pc_func) returns error.
I guess there may be better way to fix it than this patch.
--- fs/nfsd/nfssvc.c.ORGv2 Fri Nov 1 16:05:44 2030
+++ fs/nfsd/nfssvc.c Fri Nov 1 17:01:59 2030
@@ -309,6 +309,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, u3
*statp = rpc_system_err;
return 1;
}
+ } else {
+ xdr_ressize_check(rqstp, (u32*)(rqstp->rq_res.head[0].iov_base+rqstp->rq_res.head[0].iov_len));
}
/* Store reply in cache. */
-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
On Friday November 1, [email protected] wrote:
> Hello,
>
> I've fixed a problem that NFSv2 won't work when NFSv2 procedure
> handler (proc->pc_func) returns error.
>
> I guess there may be better way to fix it than this patch.
Thanks for noticing this.
I think this problem will affect lockd as well, so a more general
patch is needed.
I came up with the following.
NeilBrown
---------------------------------
Make sure final xdr_buf.len is correct on server reply
rq_res->len was not always updated properly.
It is only needed in the sendto routine, so we calculate
it just before that is called.
----------- Diffstat output ------------
./net/sunrpc/svcsock.c | 7 +++++++
1 files changed, 7 insertions(+)
--- ./net/sunrpc/svcsock.c 2002/11/03 22:12:12 1.2
+++ ./net/sunrpc/svcsock.c 2002/11/03 22:30:54 1.3
@@ -1195,6 +1195,7 @@ svc_send(struct svc_rqst *rqstp)
{
struct svc_sock *svsk;
int len;
+ struct xdr_buf *xb;
if ((svsk = rqstp->rq_sock) == NULL) {
printk(KERN_WARNING "NULL socket pointer in %s:%d\n",
@@ -1205,6 +1206,12 @@ svc_send(struct svc_rqst *rqstp)
/* release the receive skb before sending the reply */
svc_release_skb(rqstp);
+ /* calculate over-all length */
+ xb = & rqstp->rq_res;
+ xb->len = xb->head[0].iov_len +
+ xb->page_len +
+ xb->tail[0].iov_len;
+
len = svsk->sk_sendto(rqstp);
svc_sock_release(rqstp);
-------------------------------------------------------
This SF.net email is sponsored by: ApacheCon, November 18-21 in
Las Vegas (supported by COMDEX), the only Apache event to be
fully supported by the ASF. http://www.apachecon.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Hello,
> > I've fixed a problem that NFSv2 won't work when NFSv2 procedure
> > handler (proc->pc_func) returns error.
> >
> > I guess there may be better way to fix it than this patch.
>
> Thanks for noticing this.
>
> I think this problem will affect lockd as well, so a more general
> patch is needed.
Yes, you're right.
> I came up with the following.
And we can also remove redundant code.
> ---------------------------------
> Make sure final xdr_buf.len is correct on server reply
>
> rq_res->len was not always updated properly.
> It is only needed in the sendto routine, so we calculate
> it just before that is called.
>
>
> ----------- Diffstat output ------------
> ./net/sunrpc/svcsock.c | 7 +++++++
> 1 files changed, 7 insertions(+)
>
> --- ./net/sunrpc/svcsock.c 2002/11/03 22:12:12 1.2
> +++ ./net/sunrpc/svcsock.c 2002/11/03 22:30:54 1.3
> @@ -1195,6 +1195,7 @@ svc_send(struct svc_rqst *rqstp)
> {
> struct svc_sock *svsk;
> int len;
> + struct xdr_buf *xb;
>
> if ((svsk = rqstp->rq_sock) == NULL) {
> printk(KERN_WARNING "NULL socket pointer in %s:%d\n",
> @@ -1205,6 +1206,12 @@ svc_send(struct svc_rqst *rqstp)
> /* release the receive skb before sending the reply */
> svc_release_skb(rqstp);
>
> + /* calculate over-all length */
> + xb = & rqstp->rq_res;
> + xb->len = xb->head[0].iov_len +
> + xb->page_len +
> + xb->tail[0].iov_len;
> +
> len = svsk->sk_sendto(rqstp);
> svc_sock_release(rqstp);
--- include/linux/sunrpc/svc.h.ORGlen Tue Nov 5 11:53:06 2030
+++ include/linux/sunrpc/svc.h Tue Nov 5 11:53:28 2030
@@ -167,7 +167,6 @@ xdr_ressize_check(struct svc_rqst *rqstp
char *cp = (char*)p;
vec->iov_len = cp - (char*)vec->iov_base;
- rqstp->rq_res.len = vec->iov_len;
return vec->iov_len <= PAGE_SIZE;
}
--- fs/nfsd/nfs3xdr.c.ORGlen Tue Nov 5 11:52:23 2030
+++ fs/nfsd/nfs3xdr.c Tue Nov 5 11:54:22 2030
@@ -615,10 +615,6 @@ nfs3svc_encode_readres(struct svc_rqst *
rqstp->rq_res.tail[0].iov_base = NULL;
rqstp->rq_res.tail[0].iov_len = 4 - (resp->count & 3);
}
- rqstp->rq_res.len =
- rqstp->rq_res.head[0].iov_len+
- rqstp->rq_res.page_len+
- rqstp->rq_res.tail[0].iov_len;
return 1;
} else
return xdr_ressize_check(rqstp, p);
@@ -688,9 +684,6 @@ nfs3svc_encode_readdirres(struct svc_rqs
*p++ = 0; /* no more entries */
*p++ = htonl(resp->common.err == nfserr_eof);
rqstp->rq_res.page_len = ((unsigned long)p & ~PAGE_MASK);
- rqstp->rq_res.len =
- rqstp->rq_res.head[0].iov_len+
- rqstp->rq_res.page_len;
return 1;
} else
return xdr_ressize_check(rqstp, p);
--- fs/nfsd/nfsxdr.c.ORGlen Tue Nov 5 11:52:18 2030
+++ fs/nfsd/nfsxdr.c Tue Nov 5 11:54:35 2030
@@ -396,10 +396,6 @@ nfssvc_encode_readres(struct svc_rqst *r
rqstp->rq_res.tail[0].iov_base = NULL;
rqstp->rq_res.tail[0].iov_len = 4 - (resp->count&3);
}
- rqstp->rq_res.len =
- rqstp->rq_res.head[0].iov_len+
- rqstp->rq_res.page_len+
- rqstp->rq_res.tail[0].iov_len;
return 1;
}
@@ -412,9 +408,6 @@ nfssvc_encode_readdirres(struct svc_rqst
*p++ = 0; /* no more entries */
*p++ = htonl((resp->common.err == nfserr_eof));
rqstp->rq_res.page_len = ((unsigned long)p & ~PAGE_MASK);
- rqstp->rq_res.len =
- rqstp->rq_res.head[0].iov_len+
- rqstp->rq_res.page_len;
return 1;
}
-------------------------------------------------------
This SF.net email is sponsored by: ApacheCon, November 18-21 in
Las Vegas (supported by COMDEX), the only Apache event to be
fully supported by the ASF. http://www.apachecon.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs