dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame qemu-virtio-9p-noatime.patch

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