Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753421AbeAKARM (ORCPT + 1 other); Wed, 10 Jan 2018 19:17:12 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:60325 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753359AbeAKARK (ORCPT ); Wed, 10 Jan 2018 19:17:10 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180111001709epoutp022ecd22b869735e2519a7a3cf9aad8c20~ImUylQZdQ3116931169epoutp02G X-AuditID: b6c32a35-c69ff700000010dd-b0-5a56acfa1999 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: Thu, 11 Jan 2018 09:17:17 +0900 Message-id: <1515629837-6735-1-git-send-email-daeho.jeong@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNIsWRmVeSWpSXmKPExsWy7bCmnu6vNWFRBp+WKVvs+bSOzeLSIneL y7vmsDkwe+xe8JnJo2/LKkaPz5vkApijUm0yUhNTUosUUvOS81My89JtlbyD453jTc0MDHUN LS3MlRTyEnNTbZVcfAJ03TJzgPYoKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVog0NjfQM Dcz1jIyM9EzMY62MTIFKElIzerqeshdc5KyY2XaJuYHxB3sXIyeHhICJxIRLW5lAbCGBHYwS R65kdzFyAdnfGSWWn73DDFP08MxkJojEBkaJUw+uskA4Pxklvn99xgZSxSagLTF9+SywsSIC HhKLz/9mAbGZBTQlNv9oArOFBfwlfu56A1bPIqAqsW/qE9YuRg4OXgE3iY+T8iGWyUmcPDaZ FWS+hMBBVonDF5axgNRICLhIbF9vDlEjLPHq+BZ2iLC0xKWjthDlqxglfl86C9Xbwigx+dhC NogGY4lPnz8zQtzDJ/Huaw8rRDOvREebEESJh8T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UXEiAGp/ PDznAQAA X-CMS-MailID: 20180111001658epcas1p1e4a99f89bf1fabab2c22f46f939e3403 X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180111001658epcas1p1e4a99f89bf1fabab2c22f46f939e3403 X-RootMTR: 20180111001658epcas1p1e4a99f89bf1fabab2c22f46f939e3403 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 Reviewed-by: Chao Yu --- 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