Fix readonly 9p filesystems by removing O_NOATIME flag

This commit is contained in:
Daniel P. Berrange 2012-03-22 15:52:02 +00:00
parent 3bd490d2d0
commit 52a7a6ecbd
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,40 @@
commit eed968607d656a218712df47a5e0432c21fd6994
Author: Daniel P. Berrange <berrange@redhat.com>
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 <mohan@in.ibm.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
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) {

View File

@ -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 <berrange@redhat.com> - 2:1.0-9
- Remove O_NOATIME for 9p filesystems
* Mon Mar 19 2012 Daniel P. Berrange <berrange@redhat.com> - 2:1.0-8
- Move udev rules to /lib/udev/rules.d (rhbz #748207)