]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovsdb-idl: Fix expected condition seqno when changes are pending.
authorDumitru Ceara <dceara@redhat.com>
Fri, 4 Dec 2020 14:54:41 +0000 (15:54 +0100)
committerIlya Maximets <i.maximets@ovn.org>
Fri, 4 Dec 2020 19:00:36 +0000 (20:00 +0100)
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.maximets@ovn.org>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
lib/ovsdb-idl.c

index e61635de0398702a7f8d12ac6ff03d1e45aecc88..efaa08a1e98f8ddcaea50aa6321cf16f27d5ff94 100644 (file)
@@ -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