All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Do not skip records with nonblocking connections (take 2)
@ 2011-06-18 14:01 Steve Dickson
  2011-06-18 17:00 ` Chuck Lever
  2011-06-21 18:43 ` [Libtirpc-devel] " Steve Dickson
  0 siblings, 2 replies; 3+ messages in thread
From: Steve Dickson @ 2011-06-18 14:01 UTC (permalink / raw)
  To: Libtirpc Devel List; +Cc: Linux NFS Mailing List

With non-blocking connections, do not skip records when receiving
the streams since entire value messages can be ignored which
in cause the entire stream to become out of sync.

For example, two mounts simultaneously send two unmaps
commands. The first one is read, then the second thrown
away due to skipping the record. Skipping this record
will cause XDR error later in processing of the stream.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 src/svc_vc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/svc_vc.c b/src/svc_vc.c
index aaaf2d7..87406f1 100644
--- a/src/svc_vc.c
+++ b/src/svc_vc.c
@@ -610,7 +610,11 @@ svc_vc_recv(xprt, msg)
 	}
 
 	xdrs->x_op = XDR_DECODE;
-	(void)xdrrec_skiprecord(xdrs);
+	/*
+	 * No need skip records with nonblocking connections
+	 */
+	if (cd->nonblock == FALSE)
+		(void)xdrrec_skiprecord(xdrs);
 	if (xdr_callmsg(xdrs, msg)) {
 		cd->x_id = msg->rm_xid;
 		return (TRUE);
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Do not skip records with nonblocking connections (take 2)
  2011-06-18 14:01 [PATCH] Do not skip records with nonblocking connections (take 2) Steve Dickson
@ 2011-06-18 17:00 ` Chuck Lever
  2011-06-21 18:43 ` [Libtirpc-devel] " Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2011-06-18 17:00 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Libtirpc Devel List, Linux NFS Mailing List


On Jun 18, 2011, at 10:01 AM, Steve Dickson wrote:

> With non-blocking connections, do not skip records when receiving
> the streams since entire value messages can be ignored which
> in cause the entire stream to become out of sync.
> 
> For example, two mounts simultaneously send two unmaps
> commands. The first one is read, then the second thrown
> away due to skipping the record. Skipping this record
> will cause XDR error later in processing of the stream.

I notice that xdrrec_skiprecord() also does a __xdrrec_getrec() on nonblocking connections.  In the current code, then, __xdrrec_getrec() is likely invoked twice in svc_vc_recv() on non-blocking connections.  After this patch, it is only invoked once.

Invoking __xdrrec_getrec() just once in both the blocking and non-blocking cases feels more correct to me, but I don't have a deep understanding of this code.  So this patch seems like the right thing to do.

> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
> src/svc_vc.c |    6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/src/svc_vc.c b/src/svc_vc.c
> index aaaf2d7..87406f1 100644
> --- a/src/svc_vc.c
> +++ b/src/svc_vc.c
> @@ -610,7 +610,11 @@ svc_vc_recv(xprt, msg)
> 	}
> 
> 	xdrs->x_op = XDR_DECODE;
> -	(void)xdrrec_skiprecord(xdrs);
> +	/*
> +	 * No need skip records with nonblocking connections
> +	 */
> +	if (cd->nonblock == FALSE)
> +		(void)xdrrec_skiprecord(xdrs);

cd->nonblock is already checked just before this code block.  As a minor optimization, I'd suggest reordering slightly so cd->nonblock is checked only once:

	xdrs->x_op = XDR_DECODE;
	if (cd->nonblock) {
		if (!__xdrrec_getrec(xdrs, &cd->strm_stat, TRUE))
			return FALSE;
	} else 
		(void)xdrrec_skiprecord(xdrs);

As long as __xdrrec_getrec() doesn't care about the value of xdrs->x_op, this should be OK to do.

> 	if (xdr_callmsg(xdrs, msg)) {
> 		cd->x_id = msg->rm_xid;
> 		return (TRUE);

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Libtirpc-devel] [PATCH] Do not skip records with nonblocking connections (take 2)
  2011-06-18 14:01 [PATCH] Do not skip records with nonblocking connections (take 2) Steve Dickson
  2011-06-18 17:00 ` Chuck Lever
@ 2011-06-21 18:43 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2011-06-21 18:43 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Libtirpc Devel List, Linux NFS Mailing List

Committed...

steved.

On 06/18/2011 10:01 AM, Steve Dickson wrote:
> With non-blocking connections, do not skip records when receiving
> the streams since entire value messages can be ignored which
> in cause the entire stream to become out of sync.
> 
> For example, two mounts simultaneously send two unmaps
> commands. The first one is read, then the second thrown
> away due to skipping the record. Skipping this record
> will cause XDR error later in processing of the stream.
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
>  src/svc_vc.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/src/svc_vc.c b/src/svc_vc.c
> index aaaf2d7..87406f1 100644
> --- a/src/svc_vc.c
> +++ b/src/svc_vc.c
> @@ -610,7 +610,11 @@ svc_vc_recv(xprt, msg)
>  	}
>  
>  	xdrs->x_op = XDR_DECODE;
> -	(void)xdrrec_skiprecord(xdrs);
> +	/*
> +	 * No need skip records with nonblocking connections
> +	 */
> +	if (cd->nonblock == FALSE)
> +		(void)xdrrec_skiprecord(xdrs);
>  	if (xdr_callmsg(xdrs, msg)) {
>  		cd->x_id = msg->rm_xid;
>  		return (TRUE);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-21 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-18 14:01 [PATCH] Do not skip records with nonblocking connections (take 2) Steve Dickson
2011-06-18 17:00 ` Chuck Lever
2011-06-21 18:43 ` [Libtirpc-devel] " Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.