In the case of a weak reference, clearing all change_seqno's can delete
useful information. Instead of clearing all seqno's when removing
track_node, only clear those values in cases including row insertion,
and row deleting if no dst_arcs remain.

Fixes: 95689f166818 ("ovsdb-idl: Preserve references for deleted rows.")
Reported-at: https://issues.redhat.com/browse/FDP-193
Signed-off-by: Mike Pattrick <[email protected]>

---
v2: Removed a redundant case.

Signed-off-by: Mike Pattrick <[email protected]>
---
 lib/ovsdb-idl.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 634fbb56d..ba720474b 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -177,6 +177,7 @@ static void 
ovsdb_idl_row_mark_backrefs_for_reparsing(struct ovsdb_idl_row *);
 static void ovsdb_idl_row_track_change(struct ovsdb_idl_row *,
                                        enum ovsdb_idl_change);
 static void ovsdb_idl_row_untrack_change(struct ovsdb_idl_row *);
+static void ovsdb_idl_row_clear_changeseqno(struct ovsdb_idl_row *);
 
 static void ovsdb_idl_txn_abort_all(struct ovsdb_idl *);
 static bool ovsdb_idl_txn_extract_mutations(struct ovsdb_idl_row *,
@@ -1374,6 +1375,7 @@ ovsdb_idl_track_clear__(struct ovsdb_idl *idl, bool 
flush_all)
                     row->updated = NULL;
                 }
                 ovsdb_idl_row_untrack_change(row);
+                ovsdb_idl_row_clear_changeseqno(row);
 
                 if (ovsdb_idl_row_is_orphan(row)) {
                     ovsdb_idl_row_unparse(row);
@@ -1632,6 +1634,7 @@ ovsdb_idl_process_update(struct ovsdb_idl_table *table,
                                  ru->columns);
         } else if (ovsdb_idl_row_is_orphan(row)) {
             ovsdb_idl_row_untrack_change(row);
+            ovsdb_idl_row_clear_changeseqno(row);
             ovsdb_idl_insert_row(row, ru->columns);
         } else {
             VLOG_ERR_RL(&semantic_rl, "cannot add existing row "UUID_FMT" to "
@@ -2283,11 +2286,15 @@ ovsdb_idl_row_untrack_change(struct ovsdb_idl_row *row)
         return;
     }
 
+    ovs_list_remove(&row->track_node);
+    ovs_list_init(&row->track_node);
+}
+
+static void ovsdb_idl_row_clear_changeseqno(struct ovsdb_idl_row *row)
+{
     row->change_seqno[OVSDB_IDL_CHANGE_INSERT] =
         row->change_seqno[OVSDB_IDL_CHANGE_MODIFY] =
         row->change_seqno[OVSDB_IDL_CHANGE_DELETE] = 0;
-    ovs_list_remove(&row->track_node);
-    ovs_list_init(&row->track_node);
 }
 
 static struct ovsdb_idl_row *
-- 
2.39.3

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to