From patchwork Mon Oct 2 20:22:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9981221 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 E342A602A0 for ; Mon, 2 Oct 2017 20:22:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D52E023F88 for ; Mon, 2 Oct 2017 20:22:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C84EB28815; Mon, 2 Oct 2017 20:22:12 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 6E18E23F88 for ; Mon, 2 Oct 2017 20:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751214AbdJBUWL (ORCPT ); Mon, 2 Oct 2017 16:22:11 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:44690 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751102AbdJBUWK (ORCPT ); Mon, 2 Oct 2017 16:22:10 -0400 Received: by mail-qt0-f195.google.com with SMTP id v28so373659qtv.1 for ; Mon, 02 Oct 2017 13:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=YA7hdXcXE6yG/OyHg+10SuE5r+pD44Hv8XBh6jjiMzo=; b=bzT+8c1UPa/S+HPEOVzTpVH7nA+LsTLXNzEHzYQ9A1z6LpVSmMvPY1Q9Wvc8Eg9+Yd 8RfeGfZaYTjENzwlAb2ZsNkFxnF12XcDUqY78CIkZW13pmUxnuJsc3McKzMzTPIt7TYc agROdcBBT+LePXA7vJ5EAIf97Yr5hPjDCuXrkHPBAraVD3YnH/auBIaldFtEBVf7Zs/h mUaI476GdJVhTUDuq4uiWbKe7qx5Jr9Yc0zWlgU9oOuwix1mCrketYuEp7vt1tbJqX9N ht4/LMeYWSWyLm18ZQJ9r2xV2odvfhI3v5nVDxLODrOfAQvXa2l1GRz0IMQQSJGQu/6U G6IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=YA7hdXcXE6yG/OyHg+10SuE5r+pD44Hv8XBh6jjiMzo=; b=ErOTez/llC1bJ/yCJ9fesUrzNtG7ide34ZeLIikpfKTlQ4jTecUZdTLyRCi1NcEJQY SNBLpSJUxUGCg6iapU8mvvhsUJ8Is8YLb7a5aXSM+A/FPXRtekTS/yaH/k80hD7J0JDV Qz7lRc82g7NWQMayQjpRyxYgmBkMQFGIWAlZDv5KJHwgl/XWhG/BKf0bQJ9oNMXYfmEE pmdxit3tqjkmK9onIzuG9bKHEnDhbCbWiEFfZUt11JcT2n/lF2G+mfUopjn3CrNPeC7I RdBVCwoxHkM9YG0DzN3InzdAu7083/XVAbLP229RAwNhBV+ifiZiYIzXhUFS18cYSJFJ orqQ== X-Gm-Message-State: AMCzsaUxN1W+KEr8gg0k4ScPpBue3JmBeZYJUMiObcCCQ8Y2EjC1wCdz dfdT0lnD5wTUfz5nHSovj+s8u/Jc X-Google-Smtp-Source: AOwi7QBCM9479L5MY6ywCZWxw9/rF/n01FtaMSve1FJTdPDjtw//zcWDNiekcrUT45IilN2vXfeqvA== X-Received: by 10.200.0.147 with SMTP id c19mr1073166qtg.76.1506975730314; Mon, 02 Oct 2017 13:22:10 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id 64sm2378319qkz.51.2017.10.02.13.22.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 13:22:09 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org Subject: [PATCH] nbd: fix -ERESTARTSYS handling Date: Mon, 2 Oct 2017 16:22:08 -0400 Message-Id: <1506975728-30910-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 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 Christoph made it so that if we return'ed BLK_STS_RESOURCE whenever we got ERESTARTSYS from sending our packets we'd return BLK_STS_OK, which means we'd never requeue and just hang. We really need to return the right value from the upper layer. Fixes: fc17b6534eb8 ("blk-mq: switch ->queue_rq return value to blk_status_t") Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 3684e21d543f..883dfebd3014 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -820,9 +820,13 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx, * appropriate. */ ret = nbd_handle_cmd(cmd, hctx->queue_num); + if (ret < 0) + ret = BLK_STS_IOERR; + else if (!ret) + ret = BLK_STS_OK; complete(&cmd->send_complete); - return ret < 0 ? BLK_STS_IOERR : BLK_STS_OK; + return ret; } static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,