]> Git Repo - qemu.git/commitdiff
hw/9pfs: Don't return type from host in readdir on local 9p filesystem
authorBastian Blank <[email protected]>
Fri, 22 Aug 2014 09:22:21 +0000 (13:22 +0400)
committerAneesh Kumar K.V <[email protected]>
Thu, 4 Sep 2014 15:51:13 +0000 (10:51 -0500)
When using mapped mode in 9pfs, readdir implementation
should not return file type in d_type from the host
readdir, instead, it should use the type stored in
the extended attributes.  Since d_type is optional
and reading ext attrs for every readdir is expensive,
it should be sufficient to just set d_type to DT_UNKNOWN,
so guest will know to look it up separately.

This is a -stable material.

Signed-off-by: Bastian Blank <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
Signed-off-by: Aneesh Kumar K.V <[email protected]>
hw/9pfs/virtio-9p-local.c

index 2787ddbe1f5eb044c93142bc8eea460a5b9ece7a..a183eee662b62b514b6d97f3644287ec93ed899f 100644 (file)
@@ -397,12 +397,15 @@ static int local_readdir_r(FsContext *ctx, V9fsFidOpenState *fs,
 
 again:
     ret = readdir_r(fs->dir, entry, result);
-    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
+    if (ctx->export_flags & V9FS_SM_MAPPED) {
+        entry->d_type = DT_UNKNOWN;
+    } else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         if (!ret && *result != NULL &&
             !strcmp(entry->d_name, VIRTFS_META_DIR)) {
             /* skp the meta data directory */
             goto again;
         }
+        entry->d_type = DT_UNKNOWN;
     }
     return ret;
 }
This page took 0.026458 seconds and 4 git commands to generate.