[ovs-dev] [PATCH] vconn: Fix vconn_get_status() return value when connection in progress.

Ben Pfaff blp at nicira.com
Sat Mar 1 00:21:01 UTC 2014


When a connection takes a few rounds of the state machine to complete,
'error' gets filled with EAGAIN until that completes.  This didn't match
the vconn_get_status() documentation, which says that it only returns a
positive errno value if there was an error.  One could fix the problem
by updating the documentation (and the callers) or by updating the
implementation.  I decided that the latter was the way to go because
the distinction between the TCP connection being in progress or complete
isn't visible to the client; what is visible to the client is the OpenFlow
negotiation being complete.

This problem is difficult to find in the unit tests because TCP connections
to localhost complete immediately.

Bug introduced by commit accaecc419cc57d (rconn: Discover errors in
rconn_run() even if rconn_recv() is never called.)

Reported-by: Anuprem Chalvadi <achalvadi at vmware.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 AUTHORS     |    1 +
 lib/vconn.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/AUTHORS b/AUTHORS
index d8f13ba..34e53c3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -144,6 +144,7 @@ André Ruß               andre.russ at hybris.com
 Andreas Beckmann        debian at abeckmann.de
 Andrei Andone           andrei.andone at softvision.ro
 Anton Matsiuk           anton.matsiuk at gmail.com
+Anuprem Chalvadi        achalvadi at vmware.com
 Atzm Watanabe           atzm at stratosphere.co.jp
 Bastian Blank           waldi at debian.org
 Ben Basler              bbasler at nicira.com
diff --git a/lib/vconn.c b/lib/vconn.c
index c1485f0..d6d239f 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -299,7 +299,7 @@ vconn_run_wait(struct vconn *vconn)
 int
 vconn_get_status(const struct vconn *vconn)
 {
-    return vconn->error;
+    return vconn->error == EAGAIN ? 0 : vconn->error;
 }
 
 int
-- 
1.7.10.4




More information about the dev mailing list