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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 CDF42C4CECE for ; Tue, 17 Mar 2020 11:15:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EC73206EC for ; Tue, 17 Mar 2020 11:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584443740; bh=jKQaUfpQcMm0yosTefLi57T/N5a+Oc6PT7XK/yITYZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TuVdTbiYr5pvn5O5QX9548LKOlDRDy5zdand08TGAASlNUNLyiClkXM1NmxRZX8oc gJaTFHwRM7V/zxhHdX+BbC1JQj4oSvR9rMp5VnEX+UPOG8bXKq4aIU1gHdmUCcUyGM 4ismpFbtfbxLwfUQWz7I03oX77HQ9Ed/FBDs41rI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729152AbgCQLL7 (ORCPT ); Tue, 17 Mar 2020 07:11:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:55454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729118AbgCQLL5 (ORCPT ); Tue, 17 Mar 2020 07:11:57 -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 C5C272071C; Tue, 17 Mar 2020 11:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584443515; bh=jKQaUfpQcMm0yosTefLi57T/N5a+Oc6PT7XK/yITYZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqxij8gEKWKcXbJiHBgHrIiP3pq4BRUS4Fn9mYNOJA4wTGYIsyKmN1cwxopdxU73p T/9svPICuJhhLVW/uW/fz/5QXby9QeDXvZGEpF1uYY8LviR2Eh0CsmfINmL7t4fldc LPyOCCr/Qh8YytgS4/ClAmUbA9O6vGwxtGZhhyFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Jens Axboe Subject: [PATCH 5.5 108/151] blk-iocost: fix incorrect vtime comparison in iocg_is_idle() Date: Tue, 17 Mar 2020 11:55:18 +0100 Message-Id: <20200317103334.129839379@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200317103326.593639086@linuxfoundation.org> References: <20200317103326.593639086@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 From: Tejun Heo commit dcd6589b11d3b1e71f516a87a7b9646ed356b4c0 upstream. vtimes may wrap and time_before/after64() should be used to determine whether a given vtime is before or after another. iocg_is_idle() was incorrectly using plain "<" comparison do determine whether done_vtime is before vtime. Here, the only thing we're interested in is whether done_vtime matches vtime which indicates that there's nothing in flight. Let's test for inequality instead. Signed-off-by: Tejun Heo Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-iocost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1318,7 +1318,7 @@ static bool iocg_is_idle(struct ioc_gq * return false; /* is something in flight? */ - if (atomic64_read(&iocg->done_vtime) < atomic64_read(&iocg->vtime)) + if (atomic64_read(&iocg->done_vtime) != atomic64_read(&iocg->vtime)) return false; return true;