GCancellable *cancellable,
GError **error)
{
+ g_autoptr(_OstreeRepoAutoTransaction) txn = NULL;
g_return_val_if_fail (self->in_transaction == FALSE, FALSE);
+ g_debug ("Preparing transaction in repository %p", self);
+
+ /* Set up to abort the transaction if we return early from this function. */
+ txn = self;
+
memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats));
self->txn_locked = _ostree_repo_lock_push (self, OSTREE_REPO_LOCK_SHARED,
struct statvfs stvfsbuf;
if (TEMP_FAILURE_RETRY (fstatvfs (self->repo_dir_fd, &stvfsbuf)) < 0)
return glnx_throw_errno_prefix (error, "fstatvfs");
+
g_mutex_lock (&self->txn_lock);
self->txn.blocksize = stvfsbuf.f_bsize;
guint64 reserved_blocks = min_free_space_calculate_reserved_blocks (self, &stvfsbuf);
cancellable, error))
return FALSE;
+ /* Success: do not abort the transaction when returning. */
+ txn = NULL;
+
if (out_transaction_resume)
*out_transaction_resume = ret_transaction_resume;
return TRUE;
{
g_return_val_if_fail (self->in_transaction == TRUE, FALSE);
+ g_debug ("Committing transaction in repository %p", self);
+
if ((self->test_error_flags & OSTREE_REPO_TEST_ERROR_PRE_COMMIT) > 0)
return glnx_throw (error, "OSTREE_REPO_TEST_ERROR_PRE_COMMIT specified");
if (!self->in_transaction)
return TRUE;
+ g_debug ("Aborting transaction in repository %p", self);
+
if (self->loose_object_devino_hash)
g_hash_table_remove_all (self->loose_object_devino_hash);