Backport patch to fix /var mountpoints

See https://github.com/ostreedev/ostree/issues/1667 for details.
This commit is contained in:
Jonathan Lebon 2018-07-04 12:18:26 -04:00
parent 56ead4746a
commit 61448e46ae
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,46 @@
From 23f3ef275c2cbf8cc3d9f6ff38898c11a5440d75 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
Date: Tue, 3 Jul 2018 17:41:45 -0400
Subject: [PATCH] switchroot: Fix regression for separately mounted /var
I made a logical error in #1617 which resulted in the exact *opposite*
behaviour we want when `/var` is a separate mount.
Split this out and lower the number of negations to make it more obvious
that it's correct.
Closes: #1667
---
src/switchroot/ostree-prepare-root.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index 53df463c..0131d246 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -151,14 +151,17 @@ main(int argc, char *argv[])
if (chdir (deploy_path) < 0)
err (EXIT_FAILURE, "failed to chdir to deploy_path");
+ /* Default to true, but in the systemd case, default to false because it's handled by
+ * ostree-system-generator. */
bool mount_var = true;
- /* In the systemd case, this is handled by ostree-system-generator by default */
-#ifndef HAVE_SYSTEMD_AND_LIBMOUNT
- /* file in /run can override that behaviour */
- if (lstat (INITRAMFS_MOUNT_VAR, &stbuf) < 0)
- mount_var = false;
+#ifdef HAVE_SYSTEMD_AND_LIBMOUNT
+ mount_var = false;
#endif
+ /* file in /run can override the default behaviour so that we definitely mount /var */
+ if (lstat (INITRAMFS_MOUNT_VAR, &stbuf) == 0)
+ mount_var = true;
+
/* Link to the deployment's /var */
if (mount_var && mount ("../../var", "var", NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
err (EXIT_FAILURE, "failed to bind mount ../../var to var");
--
2.17.1

View File

@ -1,9 +1,10 @@
Summary: Tool for managing bootable, immutable filesystem trees
Name: ostree
Version: 2018.6
Release: 3%{?dist}
Release: 4%{?dist}
Source0: https://github.com/ostreedev/%{name}/releases/download/v%{version}/libostree-%{version}.tar.xz
Patch32: 0001-lib-repo-Fix-32-bit-format-string-error.patch
Patch33: 0001-switchroot-Fix-regression-for-separately-mounted-var.patch
License: LGPLv2+
URL: https://ostree.readthedocs.io/en/latest/
@ -154,6 +155,10 @@ find %{buildroot} -name '*.la' -delete
%{_libexecdir}/libostree/ostree-trivial-httpd
%changelog
* Wed Jul 04 2018 Jonathan Lebon <jonathan@jlebon.com> - 2018.6-4
- Backport patch to fix /var mountpoints
https://github.com/ostreedev/ostree/issues/1667
* Thu Jun 21 2018 Colin Walters <walters@redhat.com> - 2018.6-3
- https://github.com/ostreedev/ostree/releases/tag/v2018.6