Linux NFS development
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: nfs@lists.sourceforge.net
Cc: bfields@fieldses.org, neilb@suse.de, gnb@sgi.com
Subject: [RFC, PATCH 1/4] svc: Fix skip computation in svc_defer and svc_revisit
Date: Fri, 19 Oct 2007 16:45:23 -0500	[thread overview]
Message-ID: <20071019214523.31422.28978.stgit@dell3.ogc.int> (raw)
In-Reply-To: <20071019214058.31422.35615.stgit@dell3.ogc.int>


The rq_arg.len includes the size of the transport header. The computations
assumed that it did not.

Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
---

 net/sunrpc/svc_xprt.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index b56bf05..13aacec 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -29,7 +29,6 @@ #include <asm/ioctls.h>
 #include <linux/sunrpc/types.h>
 #include <linux/sunrpc/clnt.h>
 #include <linux/sunrpc/xdr.h>
-#include <linux/sunrpc/svcsock.h>
 #include <linux/sunrpc/stats.h>
 #include <linux/sunrpc/svc_xprt.h>
 
@@ -162,7 +161,7 @@ EXPORT_SYMBOL_GPL(svc_xprt_init);
 
 static int svc_local_port(struct svc_xprt *xprt)
 {
-	int ret = 0;
+	int ret = -1;
 	switch (xprt->xpt_local.ss_family) {
 	case AF_INET:
 		ret = ntohs(((struct sockaddr_in *)
@@ -891,8 +890,7 @@ static struct cache_deferred_req *svc_de
 		int skip;
 		int size;
 		/* FIXME maybe discard if size too large */
-		size = sizeof(struct svc_deferred_req) + rqstp->rq_arg.len +
-			rqstp->rq_xprt_hlen;
+		size = sizeof(struct svc_deferred_req) + rqstp->rq_arg.len;
 		dr = kmalloc(size, GFP_KERNEL);
 		if (dr == NULL)
 			return NULL;
@@ -902,12 +900,12 @@ static struct cache_deferred_req *svc_de
 		memcpy(&dr->addr, &rqstp->rq_addr, rqstp->rq_addrlen);
 		dr->addrlen = rqstp->rq_addrlen;
 		dr->daddr = rqstp->rq_daddr;
-		dr->argslen = (rqstp->rq_arg.len + rqstp->rq_xprt_hlen) >> 2;
+		dr->argslen = rqstp->rq_arg.len>>2;
 		dr->xprt_hlen = rqstp->rq_xprt_hlen;
 
 		/* back up head to the start of the buffer and copy */
-		skip = (rqstp->rq_arg.len + rqstp->rq_xprt_hlen) -
-			rqstp->rq_arg.head[0].iov_len;
+		skip = rqstp->rq_arg.len - rqstp->rq_arg.head[0].iov_len;
+
 		memcpy(dr->args, rqstp->rq_arg.head[0].iov_base - skip,
 		       dr->argslen << 2);
 	}
@@ -930,8 +928,8 @@ static int svc_deferred_recv(struct svc_
 	/* The iov_len doesn't include the transport header bytes */
 	rqstp->rq_arg.head[0].iov_len = (dr->argslen<<2) - dr->xprt_hlen;
 	rqstp->rq_arg.page_len = 0;
-	/* The rq_arg len does not include the transport header bytes */
-	rqstp->rq_arg.len = (dr->argslen<<2) - dr->xprt_hlen;
+	/* The rq_arg len includes the transport header bytes */
+	rqstp->rq_arg.len     = dr->argslen<<2;
 	rqstp->rq_prot        = dr->prot;
 	memcpy(&rqstp->rq_addr, &dr->addr, dr->addrlen);
 	rqstp->rq_addrlen     = dr->addrlen;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  reply	other threads:[~2007-10-19 21:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19 21:40 [RFC, PATCH 0/4] svc: New transport bugs found porting svcrdma Tom Tucker
2007-10-19 21:45 ` Tom Tucker [this message]
2007-10-23  2:45   ` [RFC, PATCH 1/4] svc: Fix skip computation in svc_defer and svc_revisit Greg Banks
2007-10-23  3:11     ` Tom Tucker
2007-10-23  3:52       ` Greg Banks
2007-10-23 18:03     ` J. Bruce Fields
2007-10-24  2:45       ` Greg Banks
2007-10-24  2:53         ` J. Bruce Fields
2007-10-19 21:45 ` [RFC, PATCH 2/4] svc: svc_addsock needs to set the svc_xprt address Tom Tucker
2007-10-22  7:15   ` Greg Banks
2007-10-19 21:45 ` [RFC, PATCH 3/4] svc: Add svc_xprt_names service to replace svc_sock_names Tom Tucker
2007-10-19 21:45 ` [RFC, PATCH 4/4] svc: Move svc_xprt_received call to follow addition of xprt to list Tom Tucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071019214523.31422.28978.stgit@dell3.ogc.int \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=gnb@sgi.com \
    --cc=neilb@suse.de \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox