Commit 17f22fe46142 tried to address this but only covered some of the
cases.

The correct way to report the expected seqno is to take into account if
there already is a condition change that was requested to the server but
not acked yet.  In that case, the new condition change request will be
sent only after the already requested one is acked.  That is, expected
condition seqno when conditions are up to date is db->cond_seqno + 2 in
this case.

Fixes: 17f22fe46142 ("ovsdb-idl: Return correct seqno from 
ovsdb_idl_db_set_condition().")
Suggested-by: Ilya Maximets <i.maxim...@ovn.org>
Signed-off-by: Dumitru Ceara <dce...@redhat.com>
---
 lib/ovsdb-idl.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index e61635d..efaa08a 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -1564,6 +1564,7 @@ ovsdb_idl_db_set_condition(struct ovsdb_idl_db *db,
 {
     struct ovsdb_idl_condition *table_cond;
     struct ovsdb_idl_table *table = ovsdb_idl_db_table_from_class(db, tc);
+    unsigned int curr_seqno = db->cond_seqno;
 
     /* Compare the new condition to the last known condition which can be
      * either "new" (not sent yet), "requested" or "acked", in this order.
@@ -1581,14 +1582,11 @@ ovsdb_idl_db_set_condition(struct ovsdb_idl_db *db,
         ovsdb_idl_condition_clone(&table->new_cond, condition);
         db->cond_changed = true;
         poll_immediate_wake();
-        return db->cond_seqno + 1;
-    } else if (table_cond != table->ack_cond) {
-        /* 'condition' was already set but has not been "acked" yet.  The IDL
-         * will be up to date when db->cond_seqno gets incremented. */
-        return db->cond_seqno + 1;
     }
 
-    return db->cond_seqno;
+    /* Conditions will be up to date when we receive replies for already
+     * requested and new conditions, if any. */
+    return curr_seqno + (table->new_cond ? 1 : 0) + (table->req_cond ? 1 : 0);
 }
 
 /* Sets the replication condition for 'tc' in 'idl' to 'condition' and
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to