Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3129443ybi; Thu, 18 Jul 2019 21:36:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyi2loco6C8QYYaFZGNi/OYA1XJTVYbr5wBdLgaQvoIA6yh8FU9ebACEhzVYQwWQTXrwV73 X-Received: by 2002:a17:902:ba96:: with SMTP id k22mr55783737pls.44.1563510974760; Thu, 18 Jul 2019 21:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563510974; cv=none; d=google.com; s=arc-20160816; b=FpbrGo3FlRZS+ZIH+HEhckVMcOag4WwJWZpTKvD0UBbGUtdhc03DnCUtPJREcHAqub eAPUx7h3PUGHk4BEdTHA8LcFl94Iyx9lMu4KW9d9r59NZeSsy3Uo+bkbjqX7VeM4o9/s by1RoUaKZ7QLeqJpFe906LmBDxxEAWEoBBuxtr3oNWvNSS2GvvNuw4ZoqyViYkshIMwf Ttclu5dDL5gUrMNnX36fEbRe33COTigmf0CQwEij3A4HXjfBDm+46qbUbhiGXla9+JAk zw3qw85BeSdP74Cg+Q3I3cjJU06r2PX4BeW71JsXd1cPD0nb3kOWCwM8fyPU+/0sVjI7 ISwg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SP42iElbEo3iuGUkYcHUIw3X2zewvUNq3Mvsp5KMx5A=; b=CG5yzW46wh/mjlbcnfKAOKHSO5Ltl3CjpT9iREQ204ZFGOfU0qNEciO7yeAha7QC7I zWSyFpE306KfXjGJwEOreDfddaYm8YRav/H+ZTbcQbXITY8K4KtXKyle3PvLDEJU7CYC /wFIIpLR+nYxoWtPRTnG8rZAJWLyvT9LCcz6CsSPpB8WDdxbk15lpy56B6AYW0r5ETUQ yCdM8ylpjjyKZutgcza9TGX7Aok41hiq3eETZXiaqWamFxTcpzH2CFaJTdNix4oclsX8 aWHSjLHhDxsB3HfWOjNbsl+RH8M248P8DdQk2ilD4WC1MBQpWDfMJC4PF7yAzKqBEMKu keZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q5TWs8TE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o131si197735pgo.445.2019.07.18.21.35.59; Thu, 18 Jul 2019 21:36:14 -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=Q5TWs8TE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728858AbfGSEBu (ORCPT + 99 others); Fri, 19 Jul 2019 00:01:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:33344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729540AbfGSEBh (ORCPT ); Fri, 19 Jul 2019 00:01:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93AE521897; Fri, 19 Jul 2019 04:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508896; bh=YPHQWDnAjj6f0it24YzhQzQrShEq69mzDHoUQixDxp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q5TWs8TEwQZ/mx7I1XRVurRH8pfS5GEG78r18znce9w5oWjT2HNj8GS5mr+TAEbZZ OqEZ8bIdN2uXJt+5Rnh08fKCqSMQNfjI7hjTdccR+I3rNnhNLGTIunVT+uvS4WlvQN vYeEyplUD/ej0aqV1qt4NV/g69ngtZaFtRP9Tguo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Heng Xiao , Chao Yu , Jaegeuk Kim , Sasha Levin , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH AUTOSEL 5.2 144/171] f2fs: fix to avoid long latency during umount Date: Thu, 18 Jul 2019 23:56:15 -0400 Message-Id: <20190719035643.14300-144-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heng Xiao [ 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