From patchwork Thu Jul 6 13:24:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Gurtovoy X-Patchwork-Id: 9828327 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 70DCE60317 for ; Thu, 6 Jul 2017 13:25:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61F442861F for ; Thu, 6 Jul 2017 13:25:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 566C52862B; Thu, 6 Jul 2017 13:25:17 +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, UNPARSEABLE_RELAY 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 D8E202861F for ; Thu, 6 Jul 2017 13:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752461AbdGFNZQ (ORCPT ); Thu, 6 Jul 2017 09:25:16 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:42543 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752068AbdGFNZP (ORCPT ); Thu, 6 Jul 2017 09:25:15 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from maxg@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Jul 2017 16:24:55 +0300 Received: from r-vnc08.mtr.labs.mlnx (r-vnc08.mtr.labs.mlnx [10.208.0.121]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v66DOn9O005983; Thu, 6 Jul 2017 16:24:49 +0300 From: Max Gurtovoy To: axboe@kernel.dk, linux-block@vger.kernel.org Cc: Max Gurtovoy Subject: [PATCH 1/1] null_blk: fix error flow for shared tags during module_init Date: Thu, 6 Jul 2017 16:24:49 +0300 Message-Id: <1499347489-10863-1-git-send-email-maxg@mellanox.com> X-Mailer: git-send-email 1.7.8.2 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 In case we use shared tags feature, blk_mq_alloc_tag_set might fail during module initialization. Check the return value and default to run without shared tag set before continuing. Also move the tagset initialization process after defining the amount of submition queues. Signed-off-by: Max Gurtovoy --- drivers/block/null_blk.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 71f4422..0b7e7e1 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c @@ -844,9 +844,6 @@ static int __init null_init(void) queue_mode = NULL_Q_MQ; } - if (queue_mode == NULL_Q_MQ && shared_tags) - null_init_tag_set(&tag_set); - if (queue_mode == NULL_Q_MQ && use_per_node_hctx) { if (submit_queues < nr_online_nodes) { pr_warn("null_blk: submit_queues param is set to %u.", @@ -858,6 +855,15 @@ static int __init null_init(void) else if (!submit_queues) submit_queues = 1; + if (queue_mode == NULL_Q_MQ && shared_tags) { + ret = null_init_tag_set(&tag_set); + if (ret) { + pr_warn("null_blk: Can't use shared tags %d\n", ret); + pr_warn("null_blk: defaults to non shared tags\n"); + shared_tags = false; + } + } + mutex_init(&lock); null_major = register_blkdev(0, "nullb");