From 79554078d08b849059389f007a00c85b471d9e3d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 26 Feb 2010 20:33:55 -0800 Subject: [PATCH] ovsdb-idl: Fix bad logic in ovsdb_idl_txn_commit() state transitions. If sending the transaction fails (jsonrpc_session_send() returns 0), then we need to transition to TXN_TRY_AGAIN. (Transitioning to TXN_INCOMPLETE is actually a no-op, because at this point in the code we are guaranteed to be in that state already.) Leaving the transaction in TXN_INCOMPLETE causes a segfault later in ovsdb_idl_txn_destroy() when it calls hmap_remove() on the transaction's txn_node. This bug reveals a hole in the ovsdb_idl_txn state machine: destroying a transaction without committing it or aborting it will cause the same problem. This problem is *not* fixed by this patch: it really should be handled by adding a new state TXN_UNCOMMITTED that indicates that the transaction is not yet committed or aborted. That's too much for this patch, and doesn't really matter for OVS at the moment since none of its code paths destroy a transaction without committing or aborting it. Bug #2435. --- lib/ovsdb-idl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index bca822464..4826d62ed 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -1226,7 +1226,7 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn) hmap_insert(&txn->idl->outstanding_txns, &txn->hmap_node, json_hash(txn->request_id, 0)); } else { - txn->status = TXN_INCOMPLETE; + txn->status = TXN_TRY_AGAIN; } ovsdb_idl_txn_disassemble(txn); -- 2.43.0