From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPZV7-0006Nq-Q6 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 12:03:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPZUy-0002IV-8P for qemu-devel@nongnu.org; Thu, 04 Sep 2014 12:03:09 -0400 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:44739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPZUx-0002IB-1f for qemu-devel@nongnu.org; Thu, 04 Sep 2014 12:02:59 -0400 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Sep 2014 21:32:57 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 1DBC71258059 for ; Thu, 4 Sep 2014 21:33:20 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s84G25LE56557786 for ; Thu, 4 Sep 2014 21:32:05 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s84G2Tmh021840 for ; Thu, 4 Sep 2014 21:32:30 +0530 From: "Aneesh Kumar K.V" Date: Thu, 4 Sep 2014 11:01:46 -0500 Message-Id: <1409846506-3407-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1409846506-3407-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1409846506-3407-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/2] hw/9pfs: Don't return type from host in readdir on local 9p filesystem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws, peter.maydell@linaro.org Cc: Bastian Blank , Michael Tokarev , qemu-devel@nongnu.org, "Aneesh Kumar K.V" From: Bastian Blank 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 Signed-off-by: Michael Tokarev Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/virtio-9p-local.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 2787ddbe1f5e..a183eee662b6 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -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; } -- 1.9.1