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
This commit is contained in:
Colin Walters 2017-11-28 13:01:46 -05:00 committed by Atomic Bot
parent 681a62b92c
commit 4eae6529ed

View File

@ -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))