From patchwork Tue Apr 19 12:07:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 612079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qq3h12t4sz9t8r for ; Tue, 19 Apr 2016 22:08:33 +1000 (AEST) Received: from localhost ([::1]:56772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asUSE-0005AL-Jz for incoming@patchwork.ozlabs.org; Tue, 19 Apr 2016 08:08:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asURR-0003lc-5h for qemu-devel@nongnu.org; Tue, 19 Apr 2016 08:07:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asURN-000332-Az for qemu-devel@nongnu.org; Tue, 19 Apr 2016 08:07:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asURL-000318-Fu; Tue, 19 Apr 2016 08:07:35 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2658462640; Tue, 19 Apr 2016 12:07:35 +0000 (UTC) Received: from localhost (ovpn-112-74.phx2.redhat.com [10.3.112.74]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3JC7XCI006150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO); Tue, 19 Apr 2016 08:07:34 -0400 From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 19 Apr 2016 08:07:28 -0400 Message-Id: <52296c723e1950a65b226d749d0fc631e5d1901b.1461067248.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 19 Apr 2016 12:07:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.6 v2 1/3] block/gluster: return correct error value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, rgowdapp@redhat.com, pkarampu@redhat.com, qemu-devel@nongnu.org, rwheeler@redhat.com, ndevos@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Upon error, gluster will call the aio callback function with a ret value of -1, with errno set to the proper error value. If we set the acb->ret value to the return value in the callback, that results in every error being EPERM (i.e. 1). Instead, set it to the proper error result. Reviewed-by: Niels de Vos Signed-off-by: Jeff Cody --- block/gluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/gluster.c b/block/gluster.c index 51e154c..b0e2cc2 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -247,7 +247,7 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) if (!ret || ret == acb->size) { acb->ret = 0; /* Success */ } else if (ret < 0) { - acb->ret = ret; /* Read/Write failed */ + acb->ret = -errno; /* Read/Write failed */ } else { acb->ret = -EIO; /* Partial read/write - fail it */ }