[ostree/wip/transaction: 2/9] repo: Make the ordering consistent between abort/complete_transaction



commit 6f12907c548bb97431b93e6d3a1a069736be51b8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Sep 5 15:30:15 2013 -0400

    repo: Make the ordering consistent between abort/complete_transaction

 src/libostree/ostree-repo.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 814babe..9ff3019 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1255,14 +1255,14 @@ ostree_repo_commit_transaction_with_stats (OstreeRepo     *self,
   if (!cleanup_tmpdir (self, cancellable, error))
     goto out;
 
-  if (!ot_gfile_ensure_unlinked (self->transaction_lock_path, cancellable, error))
-    goto out;
-
   if (self->loose_object_devino_hash)
     g_hash_table_remove_all (self->loose_object_devino_hash);
 
   self->in_transaction = FALSE;
 
+  if (!ot_gfile_ensure_unlinked (self->transaction_lock_path, cancellable, error))
+    goto out;
+
   if (out_metadata_objects_total) *out_metadata_objects_total = self->txn_metadata_objects_total;
   if (out_metadata_objects_written) *out_metadata_objects_written = self->txn_metadata_objects_written;
   if (out_content_objects_total) *out_content_objects_total = self->txn_content_objects_total;
@@ -1290,13 +1290,16 @@ ostree_repo_abort_transaction (OstreeRepo     *self,
 {
   gboolean ret = FALSE;
 
+  g_return_val_if_fail (self->in_transaction == TRUE, FALSE);
+
   if (!cleanup_tmpdir (self, cancellable, error))
     goto out;
 
-  self->in_transaction = FALSE;
   if (self->loose_object_devino_hash)
     g_hash_table_remove_all (self->loose_object_devino_hash);
 
+  self->in_transaction = FALSE;
+
   ret = TRUE;
  out:
   return ret;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]