From patchwork Thu Aug 30 07:36:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 1386751 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 031B8DF215 for ; Thu, 30 Aug 2012 07:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884Ab2H3Hgu (ORCPT ); Thu, 30 Aug 2012 03:36:50 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:53438 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727Ab2H3Hgo (ORCPT ); Thu, 30 Aug 2012 03:36:44 -0400 Received: by mail-wi0-f172.google.com with SMTP id r5so7463006wic.1 for ; Thu, 30 Aug 2012 00:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=vE/RhKdd+yqS8MgR7LohFqYpDMRDE+Ocgl05S+PQeTE=; b=DkL3kT9XSntyAINZxFTvfTZb1M0U3gUfrLPIf36ofBh0li65XEz2OwKN/rP2Gb4Cfp qqUjVzejguXDzg3BSa0DhxKRhNofK6FtajlrgfaBsXRvoLFovhaPHPRmWnLK8x03WzL7 2Q5EZIiB+r+u5M7QCAAZx7LKBFi2xaE0ZsF6hYLfc2guko2wGvhNkUafoWQeSV3jbFfY pII4rOmgJhYe3bt3OjZcO28E9Uvz7q5Ul6IiPskDgNgoitYj7kkEQ2kz/osOKjJqkP25 g+zce9PO0X0B7EbY3vCTlormWMuPRncLQAiuGIHYXHP0Tq8m8M/o+8of/mMYoo8ff76s F9ug== Received: by 10.180.102.136 with SMTP id fo8mr9288939wib.19.1346312204137; Thu, 30 Aug 2012 00:36:44 -0700 (PDT) Received: from lappy.capriciverd.com (20.Red-80-59-140.staticIP.rima-tde.net. [80.59.140.20]) by mx.google.com with ESMTPS id fr4sm2847342wib.8.2012.08.30.00.36.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Aug 2012 00:36:43 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: asias.hejun@gmail.com, mingo@elte.hu, gorcunov@openvz.org, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 6/7] kvm tools: 9p don't nuke fids on attach Date: Thu, 30 Aug 2012 09:36:42 +0200 Message-Id: <1346312203-29456-6-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346312203-29456-1-git-send-email-levinsasha928@gmail.com> References: <1346312203-29456-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We're not supposed to kill all fids when a new attach request arrives. This used to cause issues when the guest would send multiple attach requests. Signed-off-by: Sasha Levin --- tools/kvm/virtio/9p.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 27ef57b..d668106 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -117,26 +117,6 @@ static void close_fid(struct p9_dev *p9dev, u32 fid) free(pfid); } -static void clear_all_fids(struct p9_dev *p9dev) -{ - struct rb_node *node = rb_first(&p9dev->fids); - - while (node) { - struct p9_fid *fid = rb_entry(node, struct p9_fid, node); - - if (fid->fd > 0) - close(fid->fd); - - if (fid->dir) - closedir(fid->dir); - - rb_erase(&fid->node, &p9dev->fids); - free(fid); - - node = rb_first(&p9dev->fids); - } -} - static void virtio_p9_set_reply_header(struct p9_pdu *pdu, u32 size) { u8 cmd; @@ -443,8 +423,6 @@ static void virtio_p9_attach(struct p9_dev *p9dev, free(uname); free(aname); - clear_all_fids(p9dev); - if (lstat(p9dev->root_dir, &st) < 0) goto err_out;