From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Chao Yu , Yunlei He , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL 4.9 31/62] f2fs: try grabbing node page lock aggressively in sync scenario Date: Sun, 2 Sep 2018 13:14:43 +0000 Message-ID: <20180902131411.183978-21-alexander.levin@microsoft.com> References: <20180902131411.183978-1-alexander.levin@microsoft.com> In-Reply-To: <20180902131411.183978-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: From: Chao Yu [ Upstream commit 4b270a8cc5047682f0a3f3f9af3b498408dbd2bc ] In synchronous scenario, like in checkpoint(), we are going to flush dirty node pages to device synchronously, we can easily failed writebacking node page due to trylock_page() failure, especially in condition of intensive lock competition, which can cause long latency of checkpoint(). So let's use lock_page() in synchronous scenario to avoid this issue. Signed-off-by: Yunlei He Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 01177ecdeab8..addff6a3b176 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1463,7 +1463,9 @@ int sync_node_pages(struct f2fs_sb_info *sbi, struct = writeback_control *wbc) !is_cold_node(page))) continue; lock_node: - if (!trylock_page(page)) + if (wbc->sync_mode =3D=3D WB_SYNC_ALL) + lock_page(page); + else if (!trylock_page(page)) continue; =20 if (unlikely(page->mapping !=3D NODE_MAPPING(sbi))) { --=20 2.17.1