From patchwork Fri Jun 4 04:38:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sripathi Kodi X-Patchwork-Id: 54538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5D8D5B7D64 for ; Fri, 4 Jun 2010 14:40:09 +1000 (EST) Received: from localhost ([127.0.0.1]:40612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKOhS-00051m-6W for incoming@patchwork.ozlabs.org; Fri, 04 Jun 2010 00:40:06 -0400 Received: from [140.186.70.92] (port=47986 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKOgY-00051h-Pb for qemu-devel@nongnu.org; Fri, 04 Jun 2010 00:39:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKOgT-00057V-Bd for qemu-devel@nongnu.org; Fri, 04 Jun 2010 00:39:10 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:44243) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKOgS-000579-Mi for qemu-devel@nongnu.org; Fri, 04 Jun 2010 00:39:05 -0400 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [202.81.31.247]) by e23smtp01.au.ibm.com (8.14.4/8.13.1) with ESMTP id o544aUqT017635 for ; Fri, 4 Jun 2010 14:36:30 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o544cw0O1572998 for ; Fri, 4 Jun 2010 14:38:58 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o544cwvj004431 for ; Fri, 4 Jun 2010 14:38:58 +1000 Received: from localhost ([9.77.126.59]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o544cuuP004402; Fri, 4 Jun 2010 14:38:57 +1000 Date: Fri, 4 Jun 2010 10:08:55 +0530 From: Sripathi Kodi To: qemu-devel@nongnu.org Message-ID: <20100604100855.126433f1@in.ibm.com> In-Reply-To: <20100603153835.29381.79722.stgit@localhost.localdomain> References: <20100603153835.29381.79722.stgit@localhost.localdomain> X-Mailer: Claws Mail 3.7.4 (GTK+ 2.18.6; i686-redhat-linux-gnu) Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: aneesh.kumar@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH] virtio-9p: Return correct error from v9fs_remove X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch got mangled last time. Resending. virtio-9p: Return correct error from v9fs_remove In v9fs_remove_post_remove() we currently ignore the error returned by the previous call to remove() and return an error only if freeing the fid fails. However, the client expects to see the error from remove(). Currently the client falsely thinks that the remove call has always succeeded. For example, doing rmdir on a non-empty directory does not return ENOTEMPTY. With this patch we ignore the error from free_fid(). The client cannot use this error value anyway. Signed-off-by: Sripathi Kodi --- hw/virtio-9p.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index e5d0112..999c0d5 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -1943,14 +1943,15 @@ typedef struct V9fsRemoveState { static void v9fs_remove_post_remove(V9fsState *s, V9fsRemoveState *vs, int err) { - /* For TREMOVE we need to clunk the fid even on failed remove */ - err = free_fid(s, vs->fidp->fid); if (err < 0) { - goto out; + err = -errno; + } else { + err = vs->offset; } - err = vs->offset; -out: + /* For TREMOVE we need to clunk the fid even on failed remove */ + free_fid(s, vs->fidp->fid); + complete_pdu(s, vs->pdu, err); qemu_free(vs); }