Backport a few more autoprune fixes

68d1d9a7 lib/deploy: skip fallocate call when requested size is 0
    - https://github.com/ostreedev/ostree/pull/2871
a51535b0 lib/deploy: Disambiguate error messages for early prune space check
    - https://github.com/ostreedev/ostree/pull/2870
This commit is contained in:
Dusty Mabe 2023-06-01 10:49:51 -04:00
parent 8eb35485b4
commit 477a121846
No known key found for this signature in database
GPG Key ID: 3302DBD73952E671
3 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From a51535b0cd9f64702c35a04d54f42b2998403b67 Mon Sep 17 00:00:00 2001
From: Dusty Mabe <dusty@dustymabe.com>
Date: Thu, 1 Jun 2023 00:00:28 -0400
Subject: [PATCH] lib/deploy: Disambiguate error messages for early prune space
check
Having the same error message in multiple places means it's not
clear which case failed. Let's make them unique.
---
src/libostree/ostree-sysroot-deploy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index 425abe8b..c5ced04c 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -2581,7 +2581,7 @@ auto_early_prune_old_deployments (OstreeSysroot *self, GPtrArray *new_deployment
gboolean bootfs_has_space = FALSE;
if (!dfd_fallocate_check (self->boot_fd, net_new_bootcsum_dirs_total_size, &bootfs_has_space,
error))
- return glnx_prefix_error (error, "Checking if bootfs has space");
+ return glnx_prefix_error (error, "Checking if bootfs has sufficient space");
/* does the bootfs have enough free space for temporarily holding both the new
* and old bootdirs? */
@@ -2607,7 +2607,7 @@ auto_early_prune_old_deployments (OstreeSysroot *self, GPtrArray *new_deployment
if (!dfd_fallocate_check (
self->boot_fd, net_new_bootcsum_dirs_total_size - bootcsum_dirs_to_remove_total_size,
&bootfs_has_space, error))
- return glnx_prefix_error (error, "Checking if bootfs has space");
+ return glnx_prefix_error (error, "Checking if prune would give bootfs sufficient space");
if (!bootfs_has_space)
{
--
2.40.1

View File

@ -0,0 +1,39 @@
From 68d1d9a7fc08c281174f57b638fa06f7aea73601 Mon Sep 17 00:00:00 2001
From: Dusty Mabe <dusty@dustymabe.com>
Date: Thu, 1 Jun 2023 09:23:41 -0400
Subject: [PATCH] lib/deploy: skip fallocate call when requested size is 0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the requested size is 0 then of course we have enough room 🙂
This avoids the fallocate call returning an EINVAL.
Closes: #2869
---
src/libostree/ostree-sysroot-deploy.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index c5ced04c..d6304734 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -2446,6 +2446,14 @@ get_kernel_layout_size (OstreeSysroot *self, OstreeDeployment *deployment, guint
static gboolean
dfd_fallocate_check (int dfd, __off_t len, gboolean *out_passed, GError **error)
{
+ /* If the requested size is 0 then return early. Passing a 0 len to
+ * fallocate results in EINVAL */
+ if (len == 0)
+ {
+ *out_passed = TRUE;
+ return TRUE;
+ }
+
g_auto (GLnxTmpfile) tmpf = {
0,
};
--
2.40.1

View File

@ -8,7 +8,7 @@
Summary: Tool for managing bootable, immutable filesystem trees Summary: Tool for managing bootable, immutable filesystem trees
Name: ostree Name: ostree
Version: 2023.3 Version: 2023.3
Release: 2%{?dist} Release: 3%{?dist}
Source0: https://github.com/ostreedev/%{name}/releases/download/v%{version}/libostree-%{version}.tar.xz Source0: https://github.com/ostreedev/%{name}/releases/download/v%{version}/libostree-%{version}.tar.xz
License: LGPLv2+ License: LGPLv2+
URL: https://ostree.readthedocs.io/en/latest/ URL: https://ostree.readthedocs.io/en/latest/
@ -18,6 +18,8 @@ Patch2: 0002-lib-deploy-Drop-unused-variable.patch
Patch3: 0003-lib-deploy-Log-case-when-auto-pruning-is-hopeless.patch Patch3: 0003-lib-deploy-Log-case-when-auto-pruning-is-hopeless.patch
Patch4: 0004-lib-deploy-Rename-variable-for-clarity.patch Patch4: 0004-lib-deploy-Rename-variable-for-clarity.patch
Patch5: 0005-lib-deploy-Use-fallocate-for-early-prune-space-check.patch Patch5: 0005-lib-deploy-Use-fallocate-for-early-prune-space-check.patch
Patch6: 0006-lib-deploy-Disambiguate-error-messages-for-early-pru.patch
Patch7: 0007-lib-deploy-skip-fallocate-call-when-requested-size-i.patch
BuildRequires: make BuildRequires: make
BuildRequires: git BuildRequires: git
@ -175,6 +177,10 @@ find %{buildroot} -name '*.la' -delete
%endif %endif
%changelog %changelog
* Thu Jun 1 2023 Dusty Mabe <dusty@dustymabe.com> - 2023.3-3
- Backport log message fix in https://github.com/ostreedev/ostree/pull/2870
- Backport fallocate fix in https://github.com/ostreedev/ostree/pull/2871
* Tue May 30 2023 Dusty Mabe <dusty@dustymabe.com> - 2023.3-2 * Tue May 30 2023 Dusty Mabe <dusty@dustymabe.com> - 2023.3-2
- Backport OSTree Autoprune fixes in https://github.com/ostreedev/ostree/pull/2866 - Backport OSTree Autoprune fixes in https://github.com/ostreedev/ostree/pull/2866