[ovs-dev] [PATCH v3] netlink-socket: Exit NL transaction loop when EINVAL is returned

Sorin Vinturis svinturis at cloudbasesolutions.com
Wed Apr 15 17:15:57 UTC 2015


The nl_sock_transact_multiple function enters in an infinite loop,
when invalid error, EINVAL, is returned by nl_sock_transact_multiple__.
EINVAL is the error returned by the latter function when a driver
request fails.

v2: Any error returned by nl_sock_transact_multiple__, except EAGAIN,
causes the rest of NL transactions to be aborted.
An error response from the driver is considered a successful transaction
and the 'done' transactions counter is incremented.

Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/57
Acked-by: Eitan Eliahu <eliahue at vmware.com>
---
 lib/netlink-socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index fab2a66..b73d843 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -797,8 +797,12 @@ nl_sock_transact_multiple__(struct nl_sock *sock,
                              txn->request->size,
                              reply_buf, sizeof reply_buf,
                              &reply_len, NULL)) {
+            /* The transaction was successfully sent but failed. */
+            (*done)++;
             /* XXX: Map to a more appropriate error. */
             error = EINVAL;
+            VLOG_DBG_RL(&rl, "fatal driver failure: %s",
+                ovs_lasterror_to_string());
             break;
         }
 
@@ -909,6 +913,11 @@ nl_sock_transact_multiple(struct nl_sock *sock,
         } else if (error) {
             VLOG_ERR_RL(&rl, "transaction error (%s)", ovs_strerror(error));
             nl_sock_record_errors__(transactions, n, error);
+            if (error != EAGAIN) {
+                /* A fatal error have occured. Abort the rest of
+                 * transactions. */
+                break;
+            }
         }
     }
 }
-- 
1.9.0.msysgit.0



More information about the dev mailing list