Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2535155yba; Mon, 6 May 2019 07:38:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2+jLxSo8ON3nS0mH4mHAry9HXQjf9J0tTy/lcfjGBnX9SsXxe1IAXLcdAIf4K786HEfhJ X-Received: by 2002:a17:902:294b:: with SMTP id g69mr32464296plb.57.1557153511260; Mon, 06 May 2019 07:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153511; cv=none; d=google.com; s=arc-20160816; b=xYX8Y1/Vds/qGfzt7UZ+b09SEuNiPJARYOZ5vWQzSy6u/0qfJiD6KIt35bz3L97U3i /3qDr+Zbzill2c3ercQ0VWkR2HAOnGjZO67W3mMHU6iwkJx4eh2HJz8R5RVRlv248hVJ wYZN6FmmjnfSUa8MTm/PCg/GFeLGjLCZyxbxlQI1NNysIp0qigaF5AqIrMR10rXyiNhV 5zGTEeaBMtmbLno1ZG/+yZ5bgRNSEZvlJj3Vja8zV19+Egz56TCuf7O9cxUJp75mL84E E+dsK5biT6C+lVVAfqkVypOmjWDmgDix29dPu6H/UQbCnehaJ0wH67Vgp6bxNzFtYBJ8 9v6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4jFiVuPd+EDNqH6UQblFdpwJFYkp6pm18ug9axTrvZI=; b=r1I6tFM6atefvk9XdkAd8WPrikr0IWwlA5QzoPK8F8ref9WsxhNVXVB7clcgBVYyRd znsDT0y5R2sIIeuXuII38xfSZ++t8ldlB0UKiyi6GRomAPgc7qEV+TI0QyovqN3btX9G /sT9rg8EdzaUFiJnArynTfs+o22vKTIUXrX/Gp2DCe82etFFRhzWLhkdawEnYdbmENfr Q9Re5hftsE3+Wzai3odYYGkgOzqENieTyx3FtEPDdUT/xz9G8yRovQkjREOHKEuNSv7N YGtPV+cliNsgannwXuqH83PudGf8G8Vu/fgJI+ITujI6ZiwajDK3aL8nWjQf8GDHGVlF IfBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tDBs7IxG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si13884305pgv.373.2019.05.06.07.38.11; Mon, 06 May 2019 07:38:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tDBs7IxG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727152AbfEFOgW (ORCPT + 99 others); Mon, 6 May 2019 10:36:22 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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