Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933740AbeAJCnk (ORCPT + 1 other); Tue, 9 Jan 2018 21:43:40 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:12661 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933701AbeAJCni (ORCPT ); Tue, 9 Jan 2018 21:43:38 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180110024336epoutp038673eb910d7a65cb1a0311930443933a~IUrYnBmZM2056220562epoutp03C X-AuditID: b6c32a47-5ebff70000001126-69-5a557dd8071d From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Daeho Jeong Subject: [PATCH] f2fs: handle newly created page when revoking inmem pages Date: Wed, 10 Jan 2018 11:43:54 +0900 Message-id: <1515552234-27964-1-git-send-email-daeho.jeong@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsWy7bCmme6N2tAog3sHlS32fFrHZnFpkbvF 5V1z2ByYPXYv+Mzk0bdlFaPH501yAcxRqTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqG lhbmSgp5ibmptkouPgG6bpk5QHuUFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZK0YaGRnqG BuZ6RkZGeibmsVZGpkAlCakZX56dYy5YzlnR++Q7cwPjZfYuRk4OCQETifNv77N2MXJxCAns YJT4/noPO4TznVFiXeduZpiqvw/nMEIkdjNKzNt6mAnC+ckoMbl/NSNIFZuAtsT05bPA5ooI eEgsPv+bBcRmFtCU2PyjCcwWFvCSuPLxGFgNi4CqxMubG8E28Aq4S1z8cJoFYpucxMljk8Fu khA4yiox7cJpqGNdJNo2NUHZwhKvjm+BsqUlnq3ayAjRsIpR4vels1DdLUDnHVvIBlFlLPHp 82dGiJP4JDoO/wXq5gCK80p0tAlBlHhIbO5bCHWFo8SFze3MICVCArESMz5wTWCUXMDIsIpR LLWgODc9tdiowFivODG3uDQvXS85P3cTIzjutdx3MG4753OIUYCDUYmH98ONkCgh1sSy4src Q4wSHMxKIry+84OjhHhTEiurUovy44tKc1KLDzGaAsNjIrOUaHI+MCXllcQbmlgamJiZGZob mRqYK4nztga4RAkJpCeWpGanphakFsH0MXFwSjUw8uzZfcaYWUBjRetH9h1+P90zMl43nH7f 72i1YMeH6Vm//Otj1lzS2JEqs//qntcKb4Wmmsx92B6ypHHyL+nfWRkxy4VTN9Q+MTe4kndu 1pSrvRZpmav9bizx+XnoerDAL4Ndp0J2nWdYrcwlMXfyxi0TGY8nnvheHWeW0HinfsXlNj/V G2pXdJRYijMSDbWYi4oTARky2SwRAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKJMWRmVeSWpSXmKPExsVy+t9jAd0btaFRBssu8Vvs+bSOzeLSIneL y7vmsDkwe+xe8JnJo2/LKkaPz5vkApijuGxSUnMyy1KL9O0SuDK+PDvHXLCcs6L3yXfmBsbL 7F2MnBwSAiYSfx/OYexi5OIQEtjJKDF5w282COcno8TlTRcZQarYBLQlpi+fBdYhIuAhsfj8 bxYQm1lAU2LzjyYwW1jAS+LKx2NgNSwCqhIvb25kBrF5BdwlLn44zQKxTU7i5LHJrBMYuRYw MqxilEwtKM5Nzy02KjDKSy3XK07MLS7NS9dLzs/dxAj07LbDWv07GB8viT/EKMDBqMTD++FG SJQQa2JZcWXuIUYJDmYlEV7f+cFRQrwpiZVVqUX58UWlOanFhxilOViUxHn5849FCgmkJ5ak ZqemFqQWwWSZODilGhglXlq7+P1jOLP6yv/AotNSrSHLbLl1DPc/Zvlff69yYlZ196qL3a5l r6xnlYTc2L933dz/XFNDqlt7vzSlHtJb6z5hToaR9SazqS9jOlbYtCh/W5uyoTyGv/bCw2tG imbr+P4XqjE8DHXgntLVs13P8sznnVnc3BHf39rxn6h5097953mCpoYSS3FGoqEWc1FxIgB2 Ekjh6AEAAA== X-CMS-MailID: 20180110024336epcas2p1003559800e7f1e59a79496fc5b79cf04 X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180110024336epcas2p1003559800e7f1e59a79496fc5b79cf04 X-RootMTR: 20180110024336epcas2p1003559800e7f1e59a79496fc5b79cf04 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..463f420 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, NULL_ADDR); + } else + f2fs_replace_block(sbi, &dn, dn.data_blkaddr, cur->old_addr, ni.version, true, true); f2fs_put_dnode(&dn); } -- 1.9.1