From patchwork Thu Jul 22 15:57:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 59614 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 44879B70DF for ; Fri, 23 Jul 2010 02:41:27 +1000 (EST) Received: from localhost ([127.0.0.1]:33737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Obypo-00041j-6z for incoming@patchwork.ozlabs.org; Thu, 22 Jul 2010 12:41:24 -0400 Received: from [140.186.70.92] (port=32978 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObyHq-0002Cf-Ax for qemu-devel@nongnu.org; Thu, 22 Jul 2010 12:06:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ObyHo-0003om-Rn for qemu-devel@nongnu.org; Thu, 22 Jul 2010 12:06:18 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:33670) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObyHo-0003oZ-Om for qemu-devel@nongnu.org; Thu, 22 Jul 2010 12:06:16 -0400 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o6MFd1RL020229 for ; Thu, 22 Jul 2010 11:39:01 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6MFtL1R129510 for ; Thu, 22 Jul 2010 11:55:26 -0400 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 o6MFtHBQ031756 for ; Thu, 22 Jul 2010 09:55:18 -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 o6MFt9hn030809; Thu, 22 Jul 2010 09:55:12 -0600 From: "Venkateswararao Jujjuri (JV)" To: qemu-devel@nongnu.org Date: Thu, 22 Jul 2010 08:57:50 -0700 Message-Id: <1279814291-8301-4-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1279814291-8301-1-git-send-email-jvrao@linux.vnet.ibm.com> References: <1279814291-8301-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-V3 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); }