nixpkgs/pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch
2022-03-10 00:03:14 +00:00

50 lines
1.7 KiB
Diff

From 9e4932ae99946b1a08ab5b5345fd2bc3486e54a5 Mon Sep 17 00:00:00 2001
From: aszlig <aszlig@nix.build>
Date: Mon, 18 Mar 2019 13:21:01 +0100
Subject: [PATCH] 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>
---
hw/9pfs/9p.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index a6d6b3f835..4eb26e2294 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -139,7 +139,6 @@ static int dotl_to_open_flags(int flags)
{ P9_DOTL_DSYNC, O_DSYNC },
{ P9_DOTL_FASYNC, FASYNC },
#ifndef CONFIG_DARWIN
- { P9_DOTL_NOATIME, O_NOATIME },
/*
* On Darwin, we could map to F_NOCACHE, which is
* similar, but doesn't quite have the same
--
2.35.1