storage: client_tipc: Checkpoint without active transaction
STORAGE_END_TRANSACTION with STORAGE_MSG_FLAG_TRANSACT_COMPLETE is
normally a no-op, but adding the STORAGE_MSG_FLAG_TRANSACT_CHECKPOINT
flag indicates that the client wants to create a checkpoint of the
current state. This change allows that combination to create a
checkpoint even when a checkpoint did not exist previously.
Test: manual
Bug: 244611675
Change-Id: I0422996279f958423fe85fb830fd2ab4cda818bf
diff --git a/client_tipc.c b/client_tipc.c
index 0c554e2..f5144ec 100644
--- a/client_tipc.c
+++ b/client_tipc.c
@@ -1246,6 +1246,11 @@
     /* abort transaction and clear sticky transaction error */
     if (msg->cmd == STORAGE_END_TRANSACTION) {
         if (msg->flags & STORAGE_MSG_FLAG_TRANSACT_COMPLETE) {
+            /* Allow checkpoint creation without an active transaction */
+            if (msg->flags & STORAGE_MSG_FLAG_TRANSACT_CHECKPOINT &&
+                !transaction_is_active(&session->tr)) {
+                transaction_activate(&session->tr);
+            }
             /* try to complete current transaction */
             if (transaction_is_active(&session->tr)) {
                 transaction_complete_etc(