about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch')
-rw-r--r--nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch b/nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch
new file mode 100644
index 000000000000..03e47a57863c
--- /dev/null
+++ b/nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch
@@ -0,0 +1,44 @@
+commit cdc3e7eeafa9f683214d2c15d52ef384c3de6611
+Author: aszlig <aszlig@nix.build>
+Date:   Mon Mar 18 13:21:01 2019 +0100
+
+    9pfs: Ignore O_NOATIME open flag
+    
+    Since Linux 4.19, overlayfs uses the O_NOATIME flag on its lowerdir,
+    which in turn causes errors when the Nix store is mounted in the guest
+    because the file owner of the store paths typically don't match the
+    owner of the QEMU process.
+    
+    After submitting a patch to the overlayfs mailing list[1], it turns out
+    that my patch was incomplete[2] and needs a bit more rework.
+    
+    So instead of using an incomplete kernel patch in nixpkgs, which affects
+    *all* users of overlayfs, not just NixOS VM tests, I decided that for
+    now it's better to patch QEMU instead.
+    
+    The change here really only ignores the O_NOATIME flag so that the
+    behaviour is similar to what NFS does. From open(2):
+    
+      This flag may not be effective on all filesystems. One example is NFS,
+      where the server maintains the access time.
+    
+    This change is therefore only temporary until the final fix lands in the
+    stable kernel releases.
+    
+    [1]: https://www.spinics.net/lists/linux-unionfs/msg06755.html
+    [2]: https://www.spinics.net/lists/linux-unionfs/msg06756.html
+    
+    Signed-off-by: aszlig <aszlig@nix.build>
+
+diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
+index 55821343e5..0b8425fe18 100644
+--- a/hw/9pfs/9p.c
++++ b/hw/9pfs/9p.c
+@@ -127,7 +127,6 @@ static int dotl_to_open_flags(int flags)
+         { P9_DOTL_LARGEFILE, O_LARGEFILE },
+         { P9_DOTL_DIRECTORY, O_DIRECTORY },
+         { P9_DOTL_NOFOLLOW, O_NOFOLLOW },
+-        { P9_DOTL_NOATIME, O_NOATIME },
+         { P9_DOTL_SYNC, O_SYNC },
+     };
+