From patchwork Mon Mar 13 14:10:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9620977 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 C695560414 for ; Mon, 13 Mar 2017 14:10:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8FEC284F1 for ; Mon, 13 Mar 2017 14:10:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC3E5284F5; Mon, 13 Mar 2017 14:10:22 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1D647284F1 for ; Mon, 13 Mar 2017 14:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751415AbdCMOKV (ORCPT ); Mon, 13 Mar 2017 10:10:21 -0400 Received: from merlin.infradead.org ([205.233.59.134]:41056 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751374AbdCMOKV (ORCPT ); Mon, 13 Mar 2017 10:10:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oHOCZn7M7jFg20NkZDvhEFoJrOn7+RmnhXLeCGHmmew=; b=swDJtcd5yXUrB56KKgei/A52x 8R+CSpdopTJtQswH5O/3pn0l0LOMwFUMutpCcpDNrIu2JxtOt/06CODWsN4WpqcV0x3szqPH193o0 Y143921MgZ0F2pK+JVwhpBOMGRcicifqFK68nSQEhCNMCvy6fu4dIsoJk3ALaShCtn0uPK/65YbX8 Cd1TVhcL2k6mn3o0uNA2og3fjWkn5RzFyLCY5Hw/TwcuhYJ5FUmy2HAuQUsP/hIsC4qOGxMCHOWhz ay+xQaUyeuaslAsJn5C4SoeyNtEjwjifeFYypYCeomoqRiBH7TP2V2wMeKJK0bVP3z42NeN9VVCTD ZOT95AYxg==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cnQft-0001V0-OX; Mon, 13 Mar 2017 14:10:14 +0000 From: Sagi Grimberg To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Subject: [PATCH] blk-mq: Fix tagset reinit in the presence of cpu hot-unplug Date: Mon, 13 Mar 2017 16:10:11 +0200 Message-Id: <1489414211-30437-1-git-send-email-sagi@grimberg.me> 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 In case cpu was unplugged, we need to make sure not to assume that the tags for that cpu are still allocated. so check for null tags when reinitializing a tagset. Reported-by: Yi Zhang Signed-off-by: Sagi Grimberg --- block/blk-mq-tag.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index e48bc2c72615..9d97bfc4d465 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -295,6 +295,9 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set) for (i = 0; i < set->nr_hw_queues; i++) { struct blk_mq_tags *tags = set->tags[i]; + if (!tags) + continue; + for (j = 0; j < tags->nr_tags; j++) { if (!tags->static_rqs[j]) continue;