From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr690104.outbound.protection.outlook.com ([40.107.69.104]:19838 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727622AbeH3WHM (ORCPT ); Thu, 30 Aug 2018 18:07:12 -0400 From: Sasha Levin To: "stable@vger.kernel.org" CC: Chao Yu , Weichao Guo , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL 4.18 063/113] f2fs: fix to clear PG_checked flag in set_page_dirty() Date: Thu, 30 Aug 2018 18:03:40 +0000 Message-ID: <20180830180050.35735-63-alexander.levin@microsoft.com> References: <20180830180050.35735-1-alexander.levin@microsoft.com> In-Reply-To: <20180830180050.35735-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: stable-owner@vger.kernel.org List-ID: From: Chao Yu [ Upstream commit 66110abc4c931f879d70e83e1281f891699364bf ] PG_checked flag will be set on data page during GC, later, we can recognize such page by the flag and migrate page to cold segment. But previously, we don't clear this flag when invalidating data page, after page redirtying, we will write it into wrong log. Let's clear PG_checked flag in set_page_dirty() to avoid this. Signed-off-by: Weichao Guo Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/data.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 8206389e84c0..b61954d40c25 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2494,6 +2494,10 @@ static int f2fs_set_data_page_dirty(struct page *pag= e) if (!PageUptodate(page)) SetPageUptodate(page); =20 + /* don't remain PG_checked flag which was set during GC */ + if (is_cold_data(page)) + clear_cold_data(page); + if (f2fs_is_atomic_file(inode) && !f2fs_is_commit_atomic_write(inode)) { if (!IS_ATOMIC_WRITTEN_PAGE(page)) { f2fs_register_inmem_page(inode, page); --=20 2.17.1