From patchwork Mon Feb 27 17:53:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9593739 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 35E2060471 for ; Mon, 27 Feb 2017 18:25:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2925327D85 for ; Mon, 27 Feb 2017 18:25:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A5AD28498; Mon, 27 Feb 2017 18:25:03 +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 59BBC27D85 for ; Mon, 27 Feb 2017 18:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751606AbdB0SZB (ORCPT ); Mon, 27 Feb 2017 13:25:01 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:36313 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751596AbdB0SZA (ORCPT ); Mon, 27 Feb 2017 13:25:00 -0500 Received: by mail-pg0-f43.google.com with SMTP id s67so47225044pgb.3 for ; Mon, 27 Feb 2017 10:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tslZh1PuA9CaLOHNz4XqbApk9RIXgmDgtwaT34XzbNE=; b=OWFJCMYhQZilMcMOsGaQbq7R1zjD1DncssmodHcniw/z5qgw3Om/d+VMc9pt6eWUf5 z47GlJGwRfWwuZHSAVxZvoj81q9YjxFS9Q1mCztBRW5H0S7Nm9BgeNiP//h9mD4ruXp4 +qaCBLalyGmxje0TcOTBMLMEVScflUtuBt2WCt1y+oDrX+ymrFJ4/16Py6Crm/luIeSH oFg/KsfUgCK8odW/JbZZMXAN7hwSSzs4fTuW1FIDseu2gSnJVWh49YRevVHkLil7k3Oy gMX4iCEU+X2bUZ3u/EIZthSPf7cKxoFAUbVBryUm7SYEckuleL7UExclqjrk8uFLp4iD QY6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tslZh1PuA9CaLOHNz4XqbApk9RIXgmDgtwaT34XzbNE=; b=Ntc+OZCIkInTlNl46NGbQPhwrNqd/6EGj2/rtJqenYLWK7UgOjp+KNXkomUMPfeI4S ETq+uV40jgxKssjXeETLDWdYPqlWlHl1VosHnl65xaGha+g1ARmxcwSNVjq2AuZpyYV/ ukgUffsPx+fmvBjw4kQQqicKEUGWOY/xnnf0d+muHYz4u6Dj3CU97Fy8YIVhd17VMm3j KOKAkrp1oJAkgpkc4/VCqfgKh7IZQUGriLMVIZNwyDGdGOR5xleS9XwGCzsvbJ0GjBK5 1JWQg/jjK6N5XpCY1GKv8RZZ0en5Q9EY7yJ9FDihGf0SETGLCORLx7KL/tnUus6NzkHP 9/Fw== X-Gm-Message-State: AMke39nakShlj9wW1rIA+8uv2MW2kQRgIcBRVIckCdFCJy1xRMic5oY4AA1lEy0SuIkxOVZC X-Received: by 10.84.136.75 with SMTP id 69mr26448740plk.172.1488218071994; Mon, 27 Feb 2017 09:54:31 -0800 (PST) Received: from vader ([2620:10d:c090:180::93d5]) by smtp.gmail.com with ESMTPSA id 74sm4965129pge.30.2017.02.27.09.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Feb 2017 09:54:31 -0800 (PST) Date: Mon, 27 Feb 2017 09:53:51 -0800 From: Omar Sandoval To: Jens Axboe , Sagi Grimberg , linux-block@vger.kernel.org Cc: kernel-team@fb.com Subject: Re: [PATCH 1/3] blk-mq: make blk_mq_alloc_request_hctx() allocate a scheduler request Message-ID: <20170227175351.GF10715@vader> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) 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 On Mon, Feb 27, 2017 at 09:47:53AM -0800, Omar Sandoval wrote: > From: Omar Sandoval > > blk_mq_alloc_request_hctx() allocates a driver request directly, unlike > its blk_mq_alloc_request() counterpart. It also crashes because it > doesn't update the tags->rqs map. > > Fix it by making it allocate a scheduler request. > > Reported-by: Sagi Grimberg > Signed-off-by: Omar Sandoval > --- > I think this should do it. Verified that normal operation still works > for me, but I'm not sure how to test the actual _hctx() alloc path. > Sagi, could you please test this series out? Hm, Sagi, your mail server seems to have rejected patches 2 and 3 because git-send-email duplicated the in-reply-to header for some reason. I've attached the patches instead. From 4715cce107df8b579734a074093a34001efd01d0 Mon Sep 17 00:00:00 2001 Message-Id: <4715cce107df8b579734a074093a34001efd01d0.1488217516.git.osandov@fb.com> In-Reply-To: References: From: Omar Sandoval Date: Mon, 27 Feb 2017 09:40:34 -0800 Subject: [PATCH 3/3] blk-mq: move update of tags->rqs to __blk_mq_alloc_request() No functional difference, it just makes a little more sense to update the tag map where we actually allocate the tag. Signed-off-by: Omar Sandoval --- Optional cleanup, since there's only one place that does this. block/blk-mq-sched.c | 2 -- block/blk-mq.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 5697b23412a1..09af8ff18719 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -134,8 +134,6 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, rq = __blk_mq_alloc_request(data, op); } else { rq = __blk_mq_alloc_request(data, op); - if (rq) - data->hctx->tags->rqs[rq->tag] = rq; } if (rq) { diff --git a/block/blk-mq.c b/block/blk-mq.c index cc9713f574a5..452c1caf978f 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -234,6 +234,7 @@ struct request *__blk_mq_alloc_request(struct blk_mq_alloc_data *data, } rq->tag = tag; rq->internal_tag = -1; + data->hctx->tags->rqs[rq->tag] = rq; } blk_mq_rq_ctx_init(data->q, data->ctx, rq, op); -- 2.12.0