From 84237cca876d4589c4d64bca791985b9f9482e0c Mon Sep 17 00:00:00 2001 From: Daniel P. Berrange Date: Mar 22 2012 15:52:26 +0000 Subject: Fix readonly 9p filesystems by removing O_NOATIME flag --- diff --git a/qemu-virtio-9p-noatime.patch b/qemu-virtio-9p-noatime.patch new file mode 100644 index 0000000..e363509 --- /dev/null +++ b/qemu-virtio-9p-noatime.patch @@ -0,0 +1,40 @@ +commit eed968607d656a218712df47a5e0432c21fd6994 +Author: Daniel P. Berrange +Date: Mon Jan 16 18:11:40 2012 +0000 + + hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode + + When 2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903 added support for + the 'readonly' flag against 9p filesystems, it also made QEMU + add the O_NOATIME flag as a side-effect. + + The O_NOATIME flag, however, may only be set by the file owner, + or a user with CAP_FOWNER capability. QEMU cannot assume that + this is the case for filesytems exported to QEMU. + + eg, run QEMU as non-root, and attempt to pass the host OS + filesystem through to the guest OS with readonly enable. + The result is that the guest OS cannot open any files at + all. + + If O_NOATIME is really required, it should be optionally + enabled via a separate QEMU command line flag. + + * hw/9pfs/virtio-9p.c: Remove O_NOATIME + + Acked-by: M. Mohan Kumar + Signed-off-by: Daniel P. Berrange + Signed-off-by: Aneesh Kumar K.V + +diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c +index dfe2025..a72ffc3 100644 +--- a/hw/9pfs/virtio-9p.c ++++ b/hw/9pfs/virtio-9p.c +@@ -1391,7 +1391,6 @@ static void v9fs_open(void *opaque) + err = -EROFS; + goto out; + } +- flags |= O_NOATIME; + } + err = v9fs_co_open(pdu, fidp, flags); + if (err < 0) { diff --git a/qemu.spec b/qemu.spec index f167c64..88b4eca 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,7 +1,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 1.0 -Release: 8%{?dist} +Release: 9%{?dist} # Epoch because we pushed a qemu-1.0 package Epoch: 2 License: GPLv2+ and LGPLv2+ and BSD @@ -111,6 +111,7 @@ Patch140: 0140-usb-ehci-sanity-check-iso-xfers.patch # General bug fixes Patch201: Fix_save-restore_of_in-kernel_i8259.patch +Patch202: qemu-virtio-9p-noatime.patch # Feature patches, should be in 1.1 before release Patch301: enable_architectural_PMU_cpuid_leaf.patch @@ -428,6 +429,7 @@ such as kvm_stat. %patch140 -p1 %patch201 -p1 +%patch202 -p1 %patch301 -p1 %patch302 -p1 @@ -814,6 +816,9 @@ fi %{_mandir}/man1/qemu-img.1* %changelog +* Thu Mar 22 2012 Daniel P. Berrange - 2:1.0-9 +- Remove O_NOATIME for 9p filesystems + * Mon Mar 19 2012 Daniel P. Berrange - 2:1.0-8 - Move udev rules to /lib/udev/rules.d (rhbz #748207)