Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp646100imu; Fri, 11 Jan 2019 06:44:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN4y6XVa9tJ9kbqCYj8DRcGpXQ07yDsAAEPFXiJW9tby64msVftmSiOwxF5VFhaq4bYhUQQO X-Received: by 2002:a62:7e13:: with SMTP id z19mr14751827pfc.94.1547217868853; Fri, 11 Jan 2019 06:44:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547217868; cv=none; d=google.com; s=arc-20160816; b=cp3Riwdl1J0SD8HOuBU42vbRNqR6Z0IciTiIvKuAPsGy6L/dAezEPEZIrV6ThxEctI jF20/AtGGVPFl8Vh0XuNLg04gAgnSvfsX9exV3aG0hqiS5vmt7J7lRxUh7NJef8zb7zz KUQVUkLlfTF4nE+zpzz67f4rXUwcuskIVXa8zy23LUcGoh6Zc44jaznbt+p5CtWmlFI7 E5Tp/CV3kXG9VWZkG4m6gh0kQ8Kz708hbckmDIMZtdYkx3DfeAHT7q+Ip4e2S71mFt/q cgQrXmcwotepvo3cqqJMxExy4y4VJ4GrvHzfrx55/Gl43tr/dXMHG0dsoiU2r9PEpZ0/ yYWA== 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=eqzzjlTDHH+ssHzzhcsWACA3YU3o/8HvNNWkTizXvFQ=; b=qL5Kli/O3d6OtBeaY121KmExot0RhjTk19gJdzlE4yywtO2fM5ZNv+TPLwbvf9mnu3 B3O5pBzjyHyd2dDFQ0oY9s4jbqOTp51cRmE5Hw2VZ9/yTRiTRvOc2ub3nyqZxblVM0l4 8XW0Ug3JxgViZQZnCpVS0frs318O0ldieySEvhQpuVWTrxzr9faww66P1H19wWXPVvtt yG4T63APWxU6P9pEfkP+Bg0YsyNX+qIQPZu6y2IsdbigHmjL9wIO6/fj5CKzXLYuAkyx ipuwmR36JGkauzJMG7+iraltFGjqLO13drppvuPOK+1V0JVj1nh8DtWN5nBnPMgHJTop 6Epw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IF2TqD4m; 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 v14si9748556pfc.76.2019.01.11.06.44.13; Fri, 11 Jan 2019 06:44:28 -0800 (PST) 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=IF2TqD4m; 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 S2404177AbfAKOmc (ORCPT + 99 others); Fri, 11 Jan 2019 09:42:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:35238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404166AbfAKOm3 (ORCPT ); Fri, 11 Jan 2019 09:42:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C0209206B6; Fri, 11 Jan 2019 14:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217748; bh=ya2H4zafnSXs90y/RmLA4RALINQUHsB9vrFMJBbUwsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IF2TqD4mlkbvnnUwE0xhnUZUuuyBAAFPyAIK51eSSIHJHOGUccE206VZ4wqyuMn6i J5M6lfIdjfcgWpE/mX1f/wyH41aSJwjniRqVoa2jgrzen+Grm9d2rAQbhsVgNmMt/S 7uTn3Ag9i8tuFvtyb4UeIMVlhZzrKgp33Ws8Oa+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Valente , Ming Lei , Jens Axboe Subject: [PATCH 4.20 26/65] block: deactivate blk_stat timer in wbt_disable_default() Date: Fri, 11 Jan 2019 15:15:12 +0100 Message-Id: <20190111131059.971083279@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131055.331350141@linuxfoundation.org> References: <20190111131055.331350141@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei commit 544fbd16a461a318cd80537d1331c0df5c6cf930 upstream. rwb_enabled() can't be changed when there is any inflight IO. wbt_disable_default() may set rwb->wb_normal as zero, however the blk_stat timer may still be pending, and the timer function will update wrb->wb_normal again. This patch introduces blk_stat_deactivate() and applies it in wbt_disable_default(), then the following IO hang triggered when running parted & switching io scheduler can be fixed: [ 369.937806] INFO: task parted:3645 blocked for more than 120 seconds. [ 369.938941] Not tainted 4.20.0-rc6-00284-g906c801e5248 #498 [ 369.939797] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 369.940768] parted D 0 3645 3239 0x00000000 [ 369.941500] Call Trace: [ 369.941874] ? __schedule+0x6d9/0x74c [ 369.942392] ? wbt_done+0x5e/0x5e [ 369.942864] ? wbt_cleanup_cb+0x16/0x16 [ 369.943404] ? wbt_done+0x5e/0x5e [ 369.943874] schedule+0x67/0x78 [ 369.944298] io_schedule+0x12/0x33 [ 369.944771] rq_qos_wait+0xb5/0x119 [ 369.945193] ? karma_partition+0x1c2/0x1c2 [ 369.945691] ? wbt_cleanup_cb+0x16/0x16 [ 369.946151] wbt_wait+0x85/0xb6 [ 369.946540] __rq_qos_throttle+0x23/0x2f [ 369.947014] blk_mq_make_request+0xe6/0x40a [ 369.947518] generic_make_request+0x192/0x2fe [ 369.948042] ? submit_bio+0x103/0x11f [ 369.948486] ? __radix_tree_lookup+0x35/0xb5 [ 369.949011] submit_bio+0x103/0x11f [ 369.949436] ? blkg_lookup_slowpath+0x25/0x44 [ 369.949962] submit_bio_wait+0x53/0x7f [ 369.950469] blkdev_issue_flush+0x8a/0xae [ 369.951032] blkdev_fsync+0x2f/0x3a [ 369.951502] do_fsync+0x2e/0x47 [ 369.951887] __x64_sys_fsync+0x10/0x13 [ 369.952374] do_syscall_64+0x89/0x149 [ 369.952819] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 369.953492] RIP: 0033:0x7f95a1e729d4 [ 369.953996] Code: Bad RIP value. [ 369.954456] RSP: 002b:00007ffdb570dd48 EFLAGS: 00000246 ORIG_RAX: 000000000000004a [ 369.955506] RAX: ffffffffffffffda RBX: 000055c2139c6be0 RCX: 00007f95a1e729d4 [ 369.956389] RDX: 0000000000000001 RSI: 0000000000001261 RDI: 0000000000000004 [ 369.957325] RBP: 0000000000000002 R08: 0000000000000000 R09: 000055c2139c6ce0 [ 369.958199] R10: 0000000000000000 R11: 0000000000000246 R12: 000055c2139c0380 [ 369.959143] R13: 0000000000000004 R14: 0000000000000100 R15: 0000000000000008 Cc: stable@vger.kernel.org Cc: Paolo Valente Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-stat.h | 5 +++++ block/blk-wbt.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) --- a/block/blk-stat.h +++ b/block/blk-stat.h @@ -145,6 +145,11 @@ static inline void blk_stat_activate_nse mod_timer(&cb->timer, jiffies + nsecs_to_jiffies(nsecs)); } +static inline void blk_stat_deactivate(struct blk_stat_callback *cb) +{ + del_timer_sync(&cb->timer); +} + /** * blk_stat_activate_msecs() - Gather block statistics during a time window in * milliseconds. --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -760,8 +760,10 @@ void wbt_disable_default(struct request_ if (!rqos) return; rwb = RQWB(rqos); - if (rwb->enable_state == WBT_STATE_ON_DEFAULT) + if (rwb->enable_state == WBT_STATE_ON_DEFAULT) { + blk_stat_deactivate(rwb->cb); rwb->wb_normal = 0; + } } EXPORT_SYMBOL_GPL(wbt_disable_default);