[ovs-dev] ovsdb-idl.c: Fix IDL change tracking xxx_is_new().
diff mbox series

Message ID 1564100775-80657-1-git-send-email-hzhou8@ebay.com
State New
Headers show
Series
  • [ovs-dev] ovsdb-idl.c: Fix IDL change tracking xxx_is_new().
Related show

Commit Message

Han Zhou July 26, 2019, 12:26 a.m. UTC
From: Han Zhou <hzhou8@ebay.com>

The commit ca545a78 made sure that xxx_is_new() for the rows
referencing other rows returned false instead of true. However,
it caused xxx_is_new() for the row being referenced returned false,
even if the row was newly added. This patch fixes it.

Fixes: ca545a787ac0 (ovsdb-idl.c: Increase seqno for change-tracking of table references.)
Signed-off-by: Han Zhou <hzhou8@ebay.com>
---
 lib/ovsdb-idl.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 1a6a4af..c3eb9ff 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -2509,10 +2509,8 @@  ovsdb_idl_process_update2(struct ovsdb_idl_table *table,
     return true;
 }
 
-/* Recursively add rows to tracked change lists for current row
- * and the rows that reference this row. */
 static void
-add_tracked_change_for_references(struct ovsdb_idl_row *row)
+add_tracked_change_for_references__(struct ovsdb_idl_row *row)
 {
     if (ovs_list_is_empty(&row->track_node) &&
             ovsdb_idl_track_is_set(row->table)) {
@@ -2524,11 +2522,22 @@  add_tracked_change_for_references(struct ovsdb_idl_row *row)
 
         const struct ovsdb_idl_arc *arc;
         LIST_FOR_EACH (arc, dst_node, &row->dst_arcs) {
-            add_tracked_change_for_references(arc->src);
+            add_tracked_change_for_references__(arc->src);
         }
     }
 }
 
+/* Recursively add rows to tracked change lists for current row
+ * and the rows that reference this row. */
+static void
+add_tracked_change_for_references(struct ovsdb_idl_row *row)
+{
+    const struct ovsdb_idl_arc *arc;
+    LIST_FOR_EACH (arc, dst_node, &row->dst_arcs) {
+        add_tracked_change_for_references__(arc->src);
+    }
+}
+
 
 /* Returns true if a column with mode OVSDB_IDL_MODE_RW changed, false
  * otherwise.
@@ -2593,6 +2602,10 @@  ovsdb_idl_row_change__(struct ovsdb_idl_row *row, const struct json *row_json,
                         = row->table->change_seqno[change]
                         = row->table->db->change_seqno + 1;
                     if (table->modes[column_idx] & OVSDB_IDL_TRACK) {
+                        if (ovs_list_is_empty(&row->track_node)) {
+                            ovs_list_push_back(&row->table->track_list,
+                                               &row->track_node);
+                        }
                         add_tracked_change_for_references(row);
                         if (!row->updated) {
                             row->updated = bitmap_allocate(class->n_columns);