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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 92B2FC433FF for ; Mon, 29 Jul 2019 20:00:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A927204EC for ; Mon, 29 Jul 2019 20:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564430449; bh=TFHEh57DC7xyPOl+8kUcu3/BHPOuWL6154cPQrf6WZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=K7bOmxvRroVG68eUnAm/d71x53x/5JTq+i5jex9FsUyZhDbC07aaJpvSnMdITwu/D VLcpsb8xwFyVuGjRFtryVJC2Ln0roogt5oDToYEnCPUcKefwk5ifVjXZ8M4+7ykIrs 9izLAlAh1oW+nVRw6Brj3CaTgElePJLiQVQfsUyk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391128AbfG2UAs (ORCPT ); Mon, 29 Jul 2019 16:00:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:43940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390845AbfG2TwJ (ORCPT ); Mon, 29 Jul 2019 15:52:09 -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 EE9BF2064A; Mon, 29 Jul 2019 19:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429929; bh=TFHEh57DC7xyPOl+8kUcu3/BHPOuWL6154cPQrf6WZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYBoqNeA9Ei47q63zefd/OBBDipNp6IFDF30KGt5mrjxob/boyDQf5Y39g6jA9+rg VlLvC7/Tkphw8Q/vrSEWF3y7mTWPhN4xAOBmIZVeoDmJnRMr10Bgato8/yV/ILdWGJ G/lhT6V36KbDAH7NLqzgoIz3Q20w7cRzJK0vd4eA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heng Xiao , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.2 141/215] f2fs: fix to avoid long latency during umount Date: Mon, 29 Jul 2019 21:22:17 +0200 Message-Id: <20190729190804.025561321@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@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 6e0cd4a9dd4df1a0afcb454f1e654b5c80685913 ] In umount, we give an constand time to handle pending discard, previously, in __issue_discard_cmd() we missed to check timeout condition in loop, result in delaying long time, fix it. Signed-off-by: Heng Xiao [Chao Yu: add commit message] Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/segment.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 8903b61457e7..291f7106537c 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1486,6 +1486,10 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, list_for_each_entry_safe(dc, tmp, pend_list, list) { f2fs_bug_on(sbi, dc->state != D_PREP); + if (dpolicy->timeout != 0 && + f2fs_time_over(sbi, dpolicy->timeout)) + break; + if (dpolicy->io_aware && i < dpolicy->io_aware_gran && !is_idle(sbi, DISCARD_TIME)) { io_interrupted = true; -- 2.20.1