From patchwork Sun Aug 29 19:02:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jvrao X-Patchwork-Id: 62963 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 5D17FB70DE for ; Mon, 30 Aug 2010 05:45:16 +1000 (EST) Received: from localhost ([127.0.0.1]:51312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OpnoQ-00061a-AR for incoming@patchwork.ozlabs.org; Sun, 29 Aug 2010 15:45:06 -0400 Received: from [140.186.70.92] (port=44640 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Opn8K-00074s-Kk for qemu-devel@nongnu.org; Sun, 29 Aug 2010 15:01:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Opn7k-0002dW-Kw for qemu-devel@nongnu.org; Sun, 29 Aug 2010 15:01:03 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:42011) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Opn7k-0002dB-DK for qemu-devel@nongnu.org; Sun, 29 Aug 2010 15:01:00 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o7TIgdtT024890 for ; Sun, 29 Aug 2010 12:42:39 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o7TIqnig080892 for ; Sun, 29 Aug 2010 12:52:49 -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 o7TIqnZi003956 for ; Sun, 29 Aug 2010 12:52:49 -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 o7TIqkJL003851; Sun, 29 Aug 2010 12:52:48 -0600 From: "Venkateswararao Jujjuri (JV)" To: qemu-devel@nongnu.org Date: Sun, 29 Aug 2010 12:02:29 -0700 Message-Id: <1283108572-20228-4-git-send-email-jvrao@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1283108572-20228-1-git-send-email-jvrao@linux.vnet.ibm.com> References: <1283108572-20228-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 -V4 03/26] 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 f385183..cea3935 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); }