diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 6cd3fcf4..533cf03a 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -1624,9 +1624,18 @@ ostree_repo_prepare_transaction (OstreeRepo *self, self->txn.max_blocks = bfree - self->reserved_blocks; else { - self->cleanup_stagedir = TRUE; - g_mutex_unlock (&self->txn_lock); - return throw_min_free_space_error (self, 0, error); + self->txn.max_blocks = 0; + /* Don't throw_min_free_space_error here; reason being that + * this transaction could be just committing metadata objects + * which are relatively small in size and we do not really + * want to block them via min-free-space-* value. Metadata + * objects helps in housekeeping and hence should be kept + * out of the strict min-free-space values. + * + * The main drivers for writing content objects will always honor + * the min-free-space value and throw_min_free_space_error in + * case of overstepping the number of reserved blocks. + */ } g_mutex_unlock (&self->txn_lock); diff --git a/tests/installed/nondestructive/itest-pull-space.sh b/tests/installed/nondestructive/itest-pull-space.sh index baf1042f..e365b86d 100755 --- a/tests/installed/nondestructive/itest-pull-space.sh +++ b/tests/installed/nondestructive/itest-pull-space.sh @@ -45,6 +45,17 @@ echo 'min-free-space-size=1MB' >> repo/config ostree --repo=repo pull-local /ostree/repo ${host_commit} echo "ok min-free-space-size (success)" +# metadata object write should succeed even if free space is lower than +# min-free-space value +rm -rf mnt/repo +ostree --repo=mnt/repo init --mode=bare-user +echo 'fsync=false' >> mnt/repo/config +echo 'min-free-space-size=10MB' >> mnt/repo/config +if ostree --repo=mnt/repo pull-local --commit-metadata-only /ostree/repo ${host_commit} 2>err.txt; then + fatal "could not write metadata objects even when min-free-space value should allow it" +fi +echo "ok metadata write even when free space is lower than min-free-space value" + rm -rf mnt/repo # Test min-free-space-size on deltas