From patchwork Thu Mar 12 14:27:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 5995361 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0ACDD9F380 for ; Thu, 12 Mar 2015 14:27:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40B5B20384 for ; Thu, 12 Mar 2015 14:27:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 640A020377 for ; Thu, 12 Mar 2015 14:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754403AbbCLO1i (ORCPT ); Thu, 12 Mar 2015 10:27:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53764 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbbCLO1h (ORCPT ); Thu, 12 Mar 2015 10:27:37 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2CERVZq023689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Mar 2015 10:27:32 -0400 Received: from localhost (ovpn-113-145.phx2.redhat.com [10.3.113.145]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2CERUaA028818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 12 Mar 2015 10:27:31 -0400 Date: Thu, 12 Mar 2015 10:27:30 -0400 From: Mike Snitzer To: Jens Axboe , Keith Busch Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, dm-devel@redhat.com, Ming Lei Subject: [PATCH 1/7 v2] blk-mq: fix use of incorrect goto label in blk_mq_init_queue error path Message-ID: <20150312142730.GA3159@redhat.com> References: <1426132602-34331-1-git-send-email-snitzer@redhat.com> <1426132602-34331-2-git-send-email-snitzer@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1426132602-34331-2-git-send-email-snitzer@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If percpu_ref_init() fails the 'err_hctxs' label should be used instead of 'err_map'. Rather than reuse 'err_hw', which was introduced if the later blk_mq_init_hw_queues() call fails, move percpu_ref_init() before blk_alloc_queue_node(). Signed-off-by: Mike Snitzer Reviewed-by: Ming Lei --- block/blk-mq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 4f4bea2..0a877d2 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1928,17 +1928,17 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) hctxs[i]->queue_num = i; } - q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node); - if (!q) - goto err_hctxs; - /* * Init percpu_ref in atomic mode so that it's faster to shutdown. * See blk_register_queue() for details. */ if (percpu_ref_init(&q->mq_usage_counter, blk_mq_usage_counter_release, PERCPU_REF_INIT_ATOMIC, GFP_KERNEL)) - goto err_map; + goto err_hctxs; + + q = blk_alloc_queue_node(GFP_KERNEL, set->numa_node); + if (!q) + goto err_hctxs; setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); blk_queue_rq_timeout(q, 30000);