From patchwork Thu Mar 31 19:21:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ansari, Shad" X-Patchwork-Id: 604270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qbZBY1kTBz9sBG for ; Fri, 1 Apr 2016 06:21:41 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id E3F091068A; Thu, 31 Mar 2016 12:21:39 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 7DBFC1064F for ; Thu, 31 Mar 2016 12:21:38 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 05B1A420250 for ; Thu, 31 Mar 2016 13:21:38 -0600 (MDT) X-ASG-Debug-ID: 1459452096-09eadd287d3f0e0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id xg8yT0ufHq1Pe7ly (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 31 Mar 2016 13:21:37 -0600 (MDT) X-Barracuda-Envelope-From: shad.ansari@hpe.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO g1t5424.austin.hp.com) (15.216.225.54) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 31 Mar 2016 19:21:36 -0000 Received-SPF: none (mx1-pf2.cudamail.com: domain at hpe.com does not designate permitted sender hosts) X-Barracuda-Apparent-Source-IP: 15.216.225.54 X-Barracuda-RBL-IP: 15.216.225.54 Received: from G2W6309.americas.hpqcorp.net (g2w6309.austin.hp.com [16.197.64.51]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by g1t5424.austin.hp.com (Postfix) with ESMTPS id CB81360 for ; Thu, 31 Mar 2016 19:21:35 +0000 (UTC) Received: from G2W6309.americas.hpqcorp.net (16.197.64.51) by G2W6309.americas.hpqcorp.net (16.197.64.51) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Thu, 31 Mar 2016 19:21:35 +0000 Received: from G9W3617.americas.hpqcorp.net (16.216.186.52) by G2W6309.americas.hpqcorp.net (16.197.64.51) with Microsoft SMTP Server (TLS) id 15.0.1076.9 via Frontend Transport; Thu, 31 Mar 2016 19:21:35 +0000 Received: from G4W3208.americas.hpqcorp.net ([169.254.7.94]) by G9W3617.americas.hpqcorp.net ([16.216.186.52]) with mapi id 14.03.0169.001; Thu, 31 Mar 2016 19:21:34 +0000 X-CudaMail-Envelope-Sender: shad.ansari@hpe.com From: "Ansari, Shad" To: "dev@openvswitch.org" X-CudaMail-MID: CM-E2-330063351 X-CudaMail-DTE: 033116 X-CudaMail-Originating-IP: 15.216.225.54 Thread-Topic: [PATCH 1/1] ovsdb-idl: Retain column values of deleted rows until change-track is cleared. X-ASG-Orig-Subj: [##CM-E2-330063351##][PATCH 1/1] ovsdb-idl: Retain column values of deleted rows until change-track is cleared. Thread-Index: AdGLgN96k8BEVe4QRLeeG0ZIbHcERA== Date: Thu, 31 Mar 2016 19:21:34 +0000 Message-ID: <8CA204A851B7B14E86E75054661E417511EB1BE3@G4W3208.americas.hpqcorp.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.32] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 15.216.225.54, Ugly c=0 p=0 Source New X-MessageSniffer-Rules: 0-0-0-10545-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1459452097 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 2.60 X-Barracuda-Spam-Status: No, SCORE=2.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC7_SA_HREF_FROM_MISMATCH_TEXT_URIx1_HL, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.28340 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 2.50 BSF_SC7_SA_HREF_FROM_MISMATCH_TEXT_URIx1_HL Custom Rule HREF_FROM_MISMATCH_TEXT_URIx1_HL Subject: [ovs-dev] [PATCH 1/1] ovsdb-idl: Retain column values of deleted rows until change-track is cleared. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" (This is in reference to mail thread - http://openvswitch.org/pipermail/dev/2016-March/068331.html) --- ovsdb-idl: Retain column values of deleted rows until change-track is cleared. When change tracking is enabled, only the row uuid of deleted rows is available. The column values are unparsed and the ovsdb_datum values are cleared so they are not available for inspection. This change leaves the column values around for inspection. The column values are cleared (unparsed) upon clearing the change track. Signed-off-by: Shad Ansari --- lib/ovsdb-idl.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 3ab05a3..be2cad2 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -181,6 +181,7 @@ static struct ovsdb_idl_row *ovsdb_idl_row_create(struct ovsdb_idl_table *, const struct uuid *); static void ovsdb_idl_row_destroy(struct ovsdb_idl_row *); static void ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *); +static void ovsdb_idl_row_free(struct ovsdb_idl_row *); static void ovsdb_idl_row_parse(struct ovsdb_idl_row *); static void ovsdb_idl_row_unparse(struct ovsdb_idl_row *); @@ -318,19 +319,12 @@ ovsdb_idl_clear(struct ovsdb_idl *idl) HMAP_FOR_EACH_SAFE (row, next_row, hmap_node, &table->rows) { struct ovsdb_idl_arc *arc, *next_arc; - if (!ovsdb_idl_row_is_orphan(row)) { - ovsdb_idl_row_unparse(row); - } LIST_FOR_EACH_SAFE (arc, next_arc, src_node, &row->src_arcs) { free(arc); } /* No need to do anything with dst_arcs: some node has those arcs * as forward arcs and will destroy them itself. */ - if (!ovs_list_is_empty(&row->track_node)) { - ovs_list_remove(&row->track_node); - } - ovsdb_idl_row_destroy(row); } } @@ -856,8 +850,7 @@ ovsdb_idl_track_clear(const struct ovsdb_idl *idl) ovs_list_remove(&row->track_node); ovs_list_init(&row->track_node); if (ovsdb_idl_row_is_orphan(row)) { - ovsdb_idl_row_clear_old(row); - free(row); + ovsdb_idl_row_free(row); } } } @@ -1619,7 +1612,7 @@ ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *idl) LIST_FOR_EACH_SAFE(row, next, track_node, &table->track_list) { if (!ovsdb_idl_track_is_set(row->table)) { ovs_list_remove(&row->track_node); - free(row); + ovsdb_idl_row_free(row); } } } @@ -1627,6 +1620,13 @@ ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *idl) } static void +ovsdb_idl_row_free(struct ovsdb_idl_row *row) +{ + ovsdb_idl_row_unparse(row); + free(row); +} + +static void ovsdb_idl_insert_row(struct ovsdb_idl_row *row, const struct json *row_json) { const struct ovsdb_idl_table_class *class = row->table->class; @@ -1646,7 +1646,6 @@ ovsdb_idl_insert_row(struct ovsdb_idl_row *row, const struct json *row_json) static void ovsdb_idl_delete_row(struct ovsdb_idl_row *row) { - ovsdb_idl_row_unparse(row); ovsdb_idl_row_clear_arcs(row, true); ovsdb_idl_row_clear_old(row); if (ovs_list_is_empty(&row->dst_arcs)) { @@ -2138,8 +2137,6 @@ ovsdb_idl_txn_disassemble(struct ovsdb_idl_txn *txn) ovsdb_idl_row_clear_arcs(row, false); ovsdb_idl_row_parse(row); } - } else { - ovsdb_idl_row_unparse(row); } ovsdb_idl_row_clear_new(row); @@ -2153,7 +2150,7 @@ ovsdb_idl_txn_disassemble(struct ovsdb_idl_txn *txn) hmap_node_nullify(&row->txn_node); if (!row->old) { hmap_remove(&row->table->rows, &row->hmap_node); - free(row); + ovsdb_idl_row_free(row); } } hmap_destroy(&txn->txn_rows); @@ -2720,12 +2717,11 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_) ovs_assert(row->new != NULL); if (!row->old) { - ovsdb_idl_row_unparse(row); ovsdb_idl_row_clear_new(row); ovs_assert(!row->prereqs); hmap_remove(&row->table->rows, &row->hmap_node); hmap_remove(&row->table->idl->txn->txn_rows, &row->txn_node); - free(row); + ovsdb_idl_row_free(row); return; } if (hmap_node_is_null(&row->txn_node)) {