From 792cfc484fe896ad5879a1a484271604d6e89226 Mon Sep 17 00:00:00 2001 From: Blair Bonnett Date: Tue, 29 Aug 2023 15:22:19 +0200 Subject: [PATCH] Move mount options into original declaration. --- mkosi/mounts.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mkosi/mounts.py b/mkosi/mounts.py index a026a41da..0a5e5fc4a 100644 --- a/mkosi/mounts.py +++ b/mkosi/mounts.py @@ -81,16 +81,19 @@ def mount_overlay( read_only: bool = True, ) -> Iterator[Path]: with tempfile.TemporaryDirectory(dir=upperdir.parent, prefix=f"{upperdir.name}-workdir") as workdir: - options = [f"lowerdir={lower}" for lower in lowerdirs] + [f"upperdir={upperdir}", f"workdir={workdir}"] - - # Disable the inodes index and metacopy (only copy metadata upwards if possible) - # options. If these are enabled (e.g., if the kernel enables them by default), - # the mount will fail if the upper directory has been earlier used with a different - # lower directory, such as with a build overlay that was generated on top of a - # different temporary root. - # See https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html#sharing-and-copying-layers - # and https://github.com/systemd/mkosi/issues/1841. - options.extend(["index=off", "metacopy=off"]) + options = [f"lowerdir={lower}" for lower in lowerdirs] + [ + f"upperdir={upperdir}", + f"workdir={workdir}", + # Disable the inodes index and metacopy (only copy metadata upwards if possible) + # options. If these are enabled (e.g., if the kernel enables them by default), + # the mount will fail if the upper directory has been earlier used with a different + # lower directory, such as with a build overlay that was generated on top of a + # different temporary root. + # See https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html#sharing-and-copying-layers + # and https://github.com/systemd/mkosi/issues/1841. + "index=off", + "metacopy=off" + ] # userxattr is only supported on overlayfs since kernel 5.11 if GenericVersion(platform.release()) >= GenericVersion("5.11"): -- 2.47.2