Remove O_NOATIME flag from 9pfs open() calls in readonly mode
PATCH 1/1 Remove O_NOATIME flag from 9pfs open() calls in readonly mode
From: "Daniel P. Berrange" <[email protected]>
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
--- hw/9pfs/virtio-9p.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
hw/9pfs/virtio-9p.c +0 -1
@@ -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 ) {
Signature · 1 line
1.7.7.5
Any thoughts on this fix ? Read-only mode is pretty useless without it for non-root users.
Daniel
Quoted 40 lines · Daniel P. Berrange
From: "Daniel P. Berrange" <[email protected]>
When
2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903added support for the 'readonly' flag against 9p filesystems, it also made QEMU add theO_NOATIMEflag as a side-effect.The
O_NOATIMEflag, however, may only be set by the file owner, or a user withCAP_FOWNERcapability. 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_NOATIMEis really required, it should be optionally enabled via a separate QEMU command line flag.*
hw/9pfs/virtio-9p.c: RemoveO_NOATIMESigned-off-by Daniel P. Berrange <[email protected]>--- hw/9pfs/virtio-9p.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)hw/9pfs/virtio-9p.c +0
-1@@ -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 ) {Signature · 1 line
1.7.7.5
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Quoted 37 lines · Daniel P. Berrange
From: "Daniel P. Berrange" <[email protected]>
When
2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903added support for the 'readonly' flag against 9p filesystems, it also made QEMU add theO_NOATIMEflag as a side-effect.The
O_NOATIMEflag, however, may only be set by the file owner, or a user withCAP_FOWNERcapability. 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_NOATIMEis really required, it should be optionally enabled via a separate QEMU command line flag.*
hw/9pfs/virtio-9p.c: RemoveO_NOATIMESigned-off-by Daniel P. Berrange <[email protected]>--- hw/9pfs/virtio-9p.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)hw/9pfs/virtio-9p.c +0
-1@@ -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 ) {