From patchwork Tue May 29 13:52:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10435493 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 CE47B602BF for ; Tue, 29 May 2018 13:55:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B96CB2877E for ; Tue, 29 May 2018 13:55:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52BE287F8; Tue, 29 May 2018 13:55:32 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 DFF2D2901A for ; Tue, 29 May 2018 13:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934474AbeE2Nww (ORCPT ); Tue, 29 May 2018 09:52:52 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36258 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934099AbeE2Nwu (ORCPT ); Tue, 29 May 2018 09:52:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To: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:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=EwDptOzfC1pXMBy+XjTp/CEXuGqP5bZfi2UJz4y4cNs=; b=lw9ulD5D4pgzkT4ppA9oPnjHF fbHU/uZogBcZz5n6IAV7zdOcwmoQ9T9MvYy09H1j3ZjRFu4AXDJMVe4m5Wipw6pbDqGrTyY0UBJzD Ab7hn0bOnAFVYEoneY8ieuIsvsh3gC8smaHcYfNOAgyPRbBhaD6mHv4nK9iiI+1RLbwPIBoIdUEjp EMxoMR0hOj2D3NoH1XXAdDj05F8BRBeKDD6q6Q46QyrHDLM4pGemdivSfv41WvlkZmxN4HM6BoNfI X7G7cKMIFFJnBCxYZOvTrLKeThr7yM5D4JJnrWUM+/AfR7mf1gSL9m3vIZRsGI4fCBg5YfZdGNWdk XrEA8U4Dw==; Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNf3P-0001OF-Qu; Tue, 29 May 2018 13:52:48 +0000 From: Christoph Hellwig To: Jens Axboe , Keith Busch Cc: Bart Van Assche , Ming Lei , Josef Bacik , Tejun Heo , Lee Duncan , Chris Leech , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH 02/14] blk-mq: Fix timeout and state order Date: Tue, 29 May 2018 15:52:27 +0200 Message-Id: <20180529135239.27005-3-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529135239.27005-1-hch@lst.de> References: <20180529135239.27005-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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 From: Keith Busch The block layer had been setting the state to in-flight prior to updating the timer. This is the wrong order since the timeout handler could observe the in-flight state with the older timeout, believing the request had expired when in fact it is just getting started. Signed-off-by: Keith Busch Reviewed-by: Hannes Reinecke --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index df928200b17e..3581a1e5c8a7 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -697,8 +697,8 @@ void blk_mq_start_request(struct request *rq) preempt_disable(); write_seqcount_begin(&rq->gstate_seq); - blk_mq_rq_update_state(rq, MQ_RQ_IN_FLIGHT); blk_add_timer(rq); + blk_mq_rq_update_state(rq, MQ_RQ_IN_FLIGHT); write_seqcount_end(&rq->gstate_seq); preempt_enable();