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: 8879191 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D3DEDBF440 for ; Tue, 19 Apr 2016 12:08:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 462E620274 for ; Tue, 19 Apr 2016 12:08:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B073E2026D for ; Tue, 19 Apr 2016 12:08:04 +0000 (UTC) Received: from localhost ([::1]:56762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asURn-0003wD-Mb for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Apr 2016 08:08:03 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */ }