From patchwork Wed Jul 21 16:04:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 59467 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 165A8B70C0 for ; Thu, 22 Jul 2010 02:31:34 +1000 (EST) Received: from localhost ([127.0.0.1]:46090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObcCO-0004t8-HN for incoming@patchwork.ozlabs.org; Wed, 21 Jul 2010 12:31:12 -0400 Received: from [140.186.70.92] (port=52843 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Obbkj-00024A-Ob for qemu-devel@nongnu.org; Wed, 21 Jul 2010 12:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Obbkc-0000ES-Ni for qemu-devel@nongnu.org; Wed, 21 Jul 2010 12:02:36 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:52864) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Obbkc-0000Dw-EL for qemu-devel@nongnu.org; Wed, 21 Jul 2010 12:02:30 -0400 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e33.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o6LFvqWJ010628 for ; Wed, 21 Jul 2010 09:57:52 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6LG2Ckb026684 for ; Wed, 21 Jul 2010 10:02:13 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o6LG2AYK015774 for ; Wed, 21 Jul 2010 10:02:10 -0600 Received: from localhost.localdomain (elm9m80.beaverton.ibm.com [9.47.81.80]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o6LG25RR015184; Wed, 21 Jul 2010 10:02:09 -0600 From: "Venkateswararao Jujjuri (JV)" To: qemu-devel@nongnu.org Date: Wed, 21 Jul 2010 09:04:38 -0700 Message-Id: <1279728299-28482-4-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1279728299-28482-1-git-send-email-jvrao@linux.vnet.ibm.com> References: <1279728299-28482-1-git-send-email-jvrao@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: aliguori@us.ibm.com, Sripathi Kodi , Venkateswararao Jujjuri Subject: [Qemu-devel] [PATCH-V2 03/24] 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 From: Sripathi Kodi Signed-off-by: Sripathi Kodi 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 Signed-off-by: Venkateswararao Jujjuri --- 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 20560e5..0540a74 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -1877,14 +1877,15 @@ static void v9fs_flush(V9fsState *s, V9fsPDU *pdu) 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); }