From patchwork Wed Oct 4 14:52:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 9984861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3514E60365 for ; Wed, 4 Oct 2017 14:53:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25C8928A7A for ; Wed, 4 Oct 2017 14:53:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AD1828B13; Wed, 4 Oct 2017 14:53:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C366728A7A for ; Wed, 4 Oct 2017 14:53:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752421AbdJDOxO (ORCPT ); Wed, 4 Oct 2017 10:53:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:59438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbdJDOxN (ORCPT ); Wed, 4 Oct 2017 10:53:13 -0400 Received: from shli-virt.localdomain (unknown [199.201.64.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B4ADF21904; Wed, 4 Oct 2017 14:53:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4ADF21904 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=shli@fb.com From: Shaohua Li To: linux-block@vger.kernel.org Cc: ming.lei@redhat.com, axboe@kernel.dk, Shaohua Li Subject: [PATCH V3 1/3] block/loop: don't hijack error number Date: Wed, 4 Oct 2017 07:52:43 -0700 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shaohua Li If the bio returns -EOPNOTSUPP, we shouldn't hijack it and return -EIO Signed-off-by: Shaohua Li Reviewed-by: Ming Lei --- drivers/block/loop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index bc8e615..6aa739f 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -460,7 +460,7 @@ static void lo_complete_rq(struct request *rq) zero_fill_bio(bio); } - blk_mq_end_request(rq, cmd->ret < 0 ? BLK_STS_IOERR : BLK_STS_OK); + blk_mq_end_request(rq, errno_to_blk_status(cmd->ret)); } static void lo_rw_aio_do_completion(struct loop_cmd *cmd) @@ -478,7 +478,7 @@ static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2) if (cmd->css) css_put(cmd->css); - cmd->ret = ret; + cmd->ret = ret > 0 ? 0 : ret; lo_rw_aio_do_completion(cmd); } @@ -1719,7 +1719,7 @@ static void loop_handle_cmd(struct loop_cmd *cmd) failed: /* complete non-aio request */ if (!cmd->use_aio || ret) { - cmd->ret = ret ? -EIO : 0; + cmd->ret = ret; blk_mq_complete_request(cmd->rq); } }