-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
417 additions
and
41 deletions.
There are no files selected for viewing
83 changes: 44 additions & 39 deletions
83
pkgs/applications/virtualization/qemu/9p-ignore-noatime.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,49 @@ | ||
commit cdc3e7eeafa9f683214d2c15d52ef384c3de6611 | ||
Author: aszlig <[email protected]> | ||
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 <[email protected]> | ||
From 9e4932ae99946b1a08ab5b5345fd2bc3486e54a5 Mon Sep 17 00:00:00 2001 | ||
From: aszlig <[email protected]> | ||
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 <[email protected]> | ||
--- | ||
hw/9pfs/9p.c | 1 - | ||
1 file changed, 1 deletion(-) | ||
|
||
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c | ||
index 55821343e5..0b8425fe18 100644 | ||
index a6d6b3f835..4eb26e2294 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 }, | ||
@@ -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 }, | ||
{ P9_DOTL_SYNC, O_SYNC }, | ||
}; | ||
|
||
/* | ||
* On Darwin, we could map to F_NOCACHE, which is | ||
* similar, but doesn't quite have the same | ||
-- | ||
2.35.1 | ||
|
77 changes: 77 additions & 0 deletions
77
pkgs/applications/virtualization/qemu/allow-virtfs-on-darwin.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
From 4ca09b7cd1d42eb6b1587fed74cd4d684e31bfbe Mon Sep 17 00:00:00 2001 | ||
From: Keno Fischer <[email protected]> | ||
Date: Sun, 27 Feb 2022 17:35:22 -0500 | ||
Subject: [PATCH] 9p: darwin: meson: Allow VirtFS on Darwin | ||
|
||
To allow VirtFS on darwin, we need to check that pthread_fchdir_np is | ||
available, which has only been available since macOS 10.12. | ||
|
||
Additionally, virtfs_proxy_helper is disabled on Darwin. This patch | ||
series does not currently provide an implementation of the proxy-helper, | ||
but this functionality could be implemented later on. | ||
|
||
Signed-off-by: Keno Fischer <[email protected]> | ||
[Michael Roitzsch: - Rebase for NixOS] | ||
Signed-off-by: Michael Roitzsch <[email protected]> | ||
[Will Cohen: - Rebase to master] | ||
Signed-off-by: Will Cohen <[email protected]> | ||
Reviewed-by: Paolo Bonzini <[email protected]> | ||
[Will Cohen: - Add check for pthread_fchdir_np to virtfs | ||
- Add comments to patch commit | ||
- Note that virtfs_proxy_helper does not work | ||
on macOS | ||
- Fully adjust meson virtfs error note to specify | ||
macOS | ||
- Rebase to master] | ||
Signed-off-by: Will Cohen <[email protected]> | ||
Message-Id: <[email protected]> | ||
Signed-off-by: Christian Schoenebeck <[email protected]> | ||
Acked-by: Christian Schoenebeck <[email protected]> | ||
--- | ||
fsdev/meson.build | 1 + | ||
meson.build | 17 +++++++++++------ | ||
2 files changed, 12 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/fsdev/meson.build b/fsdev/meson.build | ||
index adf57cc43e..b632b66348 100644 | ||
--- a/fsdev/meson.build | ||
+++ b/fsdev/meson.build | ||
@@ -7,6 +7,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( | ||
'qemu-fsdev.c', | ||
), if_false: files('qemu-fsdev-dummy.c')) | ||
softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss) | ||
+softmmu_ss.add_all(when: 'CONFIG_DARWIN', if_true: fsdev_ss) | ||
|
||
if have_virtfs_proxy_helper | ||
executable('virtfs-proxy-helper', | ||
diff --git a/meson.build b/meson.build | ||
index 2265fa409a..6d73c02903 100644 | ||
--- a/meson.build | ||
+++ b/meson.build | ||
@@ -1383,12 +1383,17 @@ endif | ||
have_host_block_device = (targetos != 'darwin' or | ||
cc.has_header('IOKit/storage/IOMedia.h')) | ||
|
||
-have_virtfs = (targetos == 'linux' and | ||
- have_system and | ||
- libattr.found() and | ||
- libcap_ng.found()) | ||
- | ||
-have_virtfs_proxy_helper = have_virtfs and have_tools | ||
+have_virtfs = get_option('virtfs') \ | ||
+ .require(targetos == 'linux' or targetos == 'darwin', | ||
+ error_message: 'virtio-9p (virtfs) requires Linux or macOS') \ | ||
+ .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'), | ||
+ error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \ | ||
+ .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()), | ||
+ error_message: 'virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel') \ | ||
+ .disable_auto_if(not have_tools and not have_system) \ | ||
+ .allowed() | ||
+ | ||
+have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools | ||
|
||
if get_option('virtfs').enabled() | ||
if not have_virtfs | ||
-- | ||
2.35.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.