From patchwork Fri Aug 22 09:22:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 382115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3071D140107 for ; Fri, 22 Aug 2014 19:23:32 +1000 (EST) Received: from localhost ([::1]:35879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKl4E-0003Ki-8G for incoming@patchwork.ozlabs.org; Fri, 22 Aug 2014 05:23:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKl3W-000283-Gm for qemu-devel@nongnu.org; Fri, 22 Aug 2014 05:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKl3Q-0001wU-UW for qemu-devel@nongnu.org; Fri, 22 Aug 2014 05:22:46 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:57733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKl3Q-0001vw-Mw for qemu-devel@nongnu.org; Fri, 22 Aug 2014 05:22:40 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id BF02F44656; Fri, 22 Aug 2014 13:22:30 +0400 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id A48096E1; Fri, 22 Aug 2014 13:22:30 +0400 (MSK) Received: (nullmailer pid 6173 invoked by uid 1000); Fri, 22 Aug 2014 09:22:30 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Fri, 22 Aug 2014 13:22:21 +0400 Message-Id: <1408699341-6126-1-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 Bug-Debian: http://bugs.debian.org/755738 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: Bastian Blank , Michael Tokarev , "Aneesh Kumar K.V" Subject: [Qemu-devel] Don't return type from host in readdir on local 9p filesystem X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: Michael Tokarev Signed-off-by: Bastian Blank --- qemu-2.0.0+dfsg.orig/hw/9pfs/virtio-9p-local.c +++ qemu-2.0.0+dfsg/hw/9pfs/virtio-9p-local.c @@ -396,12 +396,16 @@ static int local_readdir_r(FsContext *ct 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; }