84237cc
commit eed968607d656a218712df47a5e0432c21fd6994
84237cc
Author: Daniel P. Berrange <berrange@redhat.com>
84237cc
Date:   Mon Jan 16 18:11:40 2012 +0000
84237cc
84237cc
    hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode
84237cc
    
84237cc
    When 2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903 added support for
84237cc
    the 'readonly' flag against 9p filesystems, it also made QEMU
84237cc
    add the O_NOATIME flag as a side-effect.
84237cc
    
84237cc
    The O_NOATIME flag, however, may only be set by the file owner,
84237cc
    or a user with CAP_FOWNER capability.  QEMU cannot assume that
84237cc
    this is the case for filesytems exported to QEMU.
84237cc
    
84237cc
    eg, run QEMU as non-root, and attempt to pass the host OS
84237cc
    filesystem through to the guest OS with readonly enable.
84237cc
    The result is that the guest OS cannot open any files at
84237cc
    all.
84237cc
    
84237cc
    If O_NOATIME is really required, it should be optionally
84237cc
    enabled via a separate QEMU command line flag.
84237cc
    
84237cc
     * hw/9pfs/virtio-9p.c: Remove O_NOATIME
84237cc
    
84237cc
    Acked-by: M. Mohan Kumar <mohan@in.ibm.com>
84237cc
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
84237cc
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
84237cc
84237cc
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
84237cc
index dfe2025..a72ffc3 100644
84237cc
--- a/hw/9pfs/virtio-9p.c
84237cc
+++ b/hw/9pfs/virtio-9p.c
84237cc
@@ -1391,7 +1391,6 @@ static void v9fs_open(void *opaque)
84237cc
                 err = -EROFS;
84237cc
                 goto out;
84237cc
             }
84237cc
-            flags |= O_NOATIME;
84237cc
         }
84237cc
         err = v9fs_co_open(pdu, fidp, flags);
84237cc
         if (err < 0) {