From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D542C04A6B for ; Mon, 6 May 2019 15:08:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 466B02053B for ; Mon, 6 May 2019 15:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557155312; bh=WZwAqtlxuEjg6/iE/ynfWMbAoNHOuqF/5Ogj6QmJDno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mZ6gwCJp8E4PkYtc+ElXe46MJMjjfSjU7GCIU00yeWiYrhbjCK3hNtXA7SDgAbN6g ja5ZuCqEdJVybP7fqBX+G6488HFb3kW4+ZfgIOkAxWGAkBViC2orYRpbB4n5n6ygca Gi7SAyRsjCS6lAsAyPvbZufx/VyKuxHrKeVayBic= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726609AbfEFOgU (ORCPT ); Mon, 6 May 2019 10:36:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:56648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727140AbfEFOgT (ORCPT ); Mon, 6 May 2019 10:36:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14C9A204EC; Mon, 6 May 2019 14:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153378; bh=WZwAqtlxuEjg6/iE/ynfWMbAoNHOuqF/5Ogj6QmJDno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDBs7IxGZSI3pO1PgzuRb6BFVIoApt7tfUC8dh7bAOiP5CNOJ8zzGuGna5aRKWLEb 69bxiq95z8xvmweXccaW1wPsonSH5Ok0cMBxU0NFA3E2pqaUgK+ERKk2/8EMnJwZtZ 5IoUlYmD0FIrweSnQWmqguffeCvVCHNtF/n9RCg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Lei , Dongli Zhang , Jens Axboe , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 066/122] blk-mq: do not reset plug->rq_count before the list is sorted Date: Mon, 6 May 2019 16:32:04 +0200 Message-Id: <20190506143100.884894875@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit bcc816dfe51ab86ca94663c7b225f2d6eb0fddb9 ] We would never be able to sort the list if we first reset plug->rq_count which is used in conditional check later. Fixes: ce5b009cff19 ("block: improve logic around when to sort a plug list") Reviewed-by: Ming Lei Signed-off-by: Dongli Zhang Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin (Microsoft) --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 97eba6d23425..5a2585d69c81 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1716,11 +1716,12 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) unsigned int depth; list_splice_init(&plug->mq_list, &list); - plug->rq_count = 0; if (plug->rq_count > 2 && plug->multiple_queues) list_sort(NULL, &list, plug_rq_cmp); + plug->rq_count = 0; + this_q = NULL; this_hctx = NULL; this_ctx = NULL; -- 2.20.1