Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932298AbeAKGuk (ORCPT + 1 other); Thu, 11 Jan 2018 01:50:40 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:4166 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753955AbeAKGui (ORCPT ); Thu, 11 Jan 2018 01:50:38 -0500 Subject: Re: [PATCH v2] f2fs: handle newly created page when revoking inmem pages To: Daeho Jeong , , References: <1515629837-6735-1-git-send-email-daeho.jeong@samsung.com> CC: , , Jaegeuk Kim From: Yunlong Song Message-ID: <33e722cc-d944-1587-8b39-42a117e04b73@huawei.com> Date: Thu, 11 Jan 2018 14:50:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1515629837-6735-1-git-send-email-daeho.jeong@samsung.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.220.140] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Should it be "When committing inmem pages is not successful" ? On 2018/1/11 8:17, Daeho Jeong wrote: > 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); > } > -- Thanks, Yunlong Song