Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754112AbeAJHs4 (ORCPT + 1 other); Wed, 10 Jan 2018 02:48:56 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:60513 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754059AbeAJHsz (ORCPT ); Wed, 10 Jan 2018 02:48:55 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180110074853epoutp01eeaf1cb24c9977597c16d7f2eaab65e4~IY17VkbG60550705507epoutp01E X-AuditID: b6c32a47-603ff70000001126-98-5a55c564cdff From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Daeho Jeong Subject: [PATCH v2] f2fs: handle newly created page when revoking inmem pages Date: Wed, 10 Jan 2018 16:49:10 +0900 Message-id: <1515570550-4497-1-git-send-email-daeho.jeong@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPIsWRmVeSWpSXmKPExsWy7bCmqW7q0dAog/lHGS32fFrHZnFpkbvF 5V1z2ByYPXYv+Mzk0bdlFaPH501yAcxRqTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqG lhbmSgp5ibmptkouPgG6bpk5QHuUFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZK0YaGRnqG BuZ6RkZGeibmsVZGpkAlCakZy/ZsYytYxlnxZG8jWwPjJfYuRk4OCQETiU0L9jF2MXJxCAns YJR43fyIGcL5zigxd/IiNpiqjT/OskMkNjBKtL2eBeX8ZJT4Nvc7K0gVm4C2xPTls8Dmigh4 SCw+/5sFxGYW0JTY/KMJzBYW8Jf4uesN2FQWAVWJmQsmgfXyCrhJtK+/zgixTU7i5LHJrCAL JAT2skqsmziXFSLhIrGgexoLhC0s8er4FqgnpCWerdrICNGwilHi96WzUN0tjBKTjy2EesJY 4tPnz4wQJ/FJdBz+C9TNARTnleh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9/1f8Ji7QFlYXomlOCPRUIu5qDgRAF9mMUno AQAA X-CMS-MailID: 20180110074852epcas2p43c4891c689db01ff6fc46291a4dcfb75 X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180110074852epcas2p43c4891c689db01ff6fc46291a4dcfb75 X-RootMTR: 20180110074852epcas2p43c4891c689db01ff6fc46291a4dcfb75 References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: When committing inmem pages is successful, we revoke already committed blocks in __revoke_inmem_pages() and finally replace the committed ones with the old blocks using f2fs_replace_block(). However, if the committed block was newly created one, the address of the old block is NEW_ADDR and __f2fs_replace_block() cannot handle NEW_ADDR as new_blkaddr properly and a kernel panic occurrs. Signed-off-by: Daeho Jeong Tested-by: Shu Tan --- fs/f2fs/segment.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index c117e09..0673d08 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -248,7 +248,11 @@ static int __revoke_inmem_pages(struct inode *inode, goto next; } get_node_info(sbi, dn.nid, &ni); - f2fs_replace_block(sbi, &dn, dn.data_blkaddr, + if (cur->old_addr == NEW_ADDR) { + invalidate_blocks(sbi, dn.data_blkaddr); + f2fs_update_data_blkaddr(&dn, NEW_ADDR); + } else + f2fs_replace_block(sbi, &dn, dn.data_blkaddr, cur->old_addr, ni.version, true, true); f2fs_put_dnode(&dn); } -- 1.9.1