From patchwork Wed Aug 30 19:17:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 9930675 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 513266032A for ; Wed, 30 Aug 2017 19:17:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4174328765 for ; Wed, 30 Aug 2017 19:17:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35F5428781; Wed, 30 Aug 2017 19:17:24 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 DCF1F28765 for ; Wed, 30 Aug 2017 19:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750968AbdH3TRW (ORCPT ); Wed, 30 Aug 2017 15:17:22 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:42228 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750864AbdH3TRV (ORCPT ); Wed, 30 Aug 2017 15:17:21 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.21/8.16.0.21) with SMTP id v7UJGuEj003699 for ; Wed, 30 Aug 2017 12:17:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=vjWSq8zT/DZZs68AiFrRcsCFFXYX+cLdD5Q7KLohjvI=; b=FhK2q7eeuLv85uB5p3KwukvNVgTKqHQ4pufPHPem4fvP6Zyb+R3CU0xLlusKykvMowyw NiRh01rvh9labJ9T16As1L5CJtTu0DTaOP+MngH0iT9YBtlThXMSjhBfMUNUUiJqwupv OUp67lhN+UNWxkdN7fF5yGd6oFabbie2Eig= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 2cnywks06p-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 30 Aug 2017 12:17:21 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB05.TheFacebook.com (192.168.16.15) with Microsoft SMTP Server id 14.3.319.2; Wed, 30 Aug 2017 12:17:20 -0700 X-ThriftRelayHost: devbig638.prn2.facebook.com Received: by devbig638.prn2.facebook.com (Postfix, from userid 11222) id 1EBD142400DC; Wed, 30 Aug 2017 12:17:19 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Shaohua Li Smtp-Origin-Hostname: devbig638.prn2.facebook.com To: CC: , Smtp-Origin-Cluster: prn2c22 Subject: [PATCH 1/3] block/loop: don't hijack error number Date: Wed, 30 Aug 2017 12:17:16 -0700 Message-ID: <89923d5cd897c8c8f53d0ea4022414b30bd7eeb7.1504120418.git.shli@fb.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: References: X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-30_08:, , signatures=0 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 If the bio returns -EOPNOTSUPP, we shouldn't hijack it and return -EIO Signed-off-by: Shaohua Li --- drivers/block/loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index ef83349..054dccc 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -464,7 +464,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_complete(struct kiocb *iocb, long ret, long ret2) @@ -1725,7 +1725,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); } }