From 4eae6529ed478e9a6fa55fc43f127043ff4db287 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 28 Nov 2017 13:01:46 -0500 Subject: [PATCH] lib/commit: Move txn stagedir deletion/unlock into one place Previously we'd delete the tmpdir in `rename_pending_loose_objects()` but do the unlock inside `ostree_repo_commit_transaction()`. Move them into the same place in the latter function for consistency. Doesn't fix anything, just a cleanup while reading the code and working on `test-concurrency.py`. Closes: #1352 Approved by: dbnicholson --- src/libostree/ostree-repo-commit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 85e2e891..e2fdf9f4 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -1435,9 +1435,6 @@ rename_pending_loose_objects (OstreeRepo *self, return glnx_throw_errno_prefix (error, "fsync"); } - if (!glnx_tmpdir_delete (&self->commit_stagedir, cancellable, error)) - return FALSE; - return TRUE; } @@ -1773,6 +1770,12 @@ ostree_repo_commit_transaction (OstreeRepo *self, if (!rename_pending_loose_objects (self, cancellable, error)) return FALSE; + g_debug ("txn commit %s", glnx_basename (self->commit_stagedir.path)); + if (!glnx_tmpdir_delete (&self->commit_stagedir, cancellable, error)) + return FALSE; + glnx_release_lock_file (&self->commit_stagedir_lock); + + /* This performs a global cleanup */ if (!cleanup_tmpdir (self, cancellable, error)) return FALSE; @@ -1789,9 +1792,6 @@ ostree_repo_commit_transaction (OstreeRepo *self, return FALSE; g_clear_pointer (&self->txn_collection_refs, g_hash_table_destroy); - glnx_tmpdir_unset (&self->commit_stagedir); - glnx_release_lock_file (&self->commit_stagedir_lock); - self->in_transaction = FALSE; if (!ot_ensure_unlinked_at (self->repo_dir_fd, "transaction", 0))