Hi Daeho,

On 2018/1/9 8:23, Daeho Jeong wrote:
> Now, we set flags of a newly created inode using set_cold_files() in
> advance of creating a new node page. By this, some inodes whose node
> page is not created yet can be linked into the global dirty list.
> 
> If the checkpoint is executed at this moment, the inode will be written
> back by writeback_single_inode() and finally update_inode_page() will
> fail to detach the inode from the global dirty list because the inode
> doesn't have a node page.
> 
> The problem is that the inode's state in VFS layer will become clean
> after execution of writeback_single_inode() and it's still linked in
> the global dirty list of f2fs and this will cause a kernel panic.

Before set_cold_files, In f2fs_new_inode, we will also dirty inode, so if
we only relocate code file initialization, would we suffer the same issue
due to below reason? If so, instead, how about check FI_NEW_INODE flag
during global dirty list flushing to decide whether we should flush that
inode? How do you think?

Thanks,

> 
> Signed-off-by: Daeho Jeong <[email protected]>
> Signed-off-by: Youngjin Gil <[email protected]>
> Tested-by: Hobin Woo <[email protected]>
> ---
>  fs/f2fs/namei.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 28bdf88..249dbef 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -201,9 +201,6 @@ static int f2fs_create(struct inode *dir, struct dentry 
> *dentry, umode_t mode,
>       if (IS_ERR(inode))
>               return PTR_ERR(inode);
>  
> -     if (!test_opt(sbi, DISABLE_EXT_IDENTIFY))
> -             set_cold_files(sbi, inode, dentry->d_name.name);
> -
>       inode->i_op = &f2fs_file_inode_operations;
>       inode->i_fop = &f2fs_file_operations;
>       inode->i_mapping->a_ops = &f2fs_dblock_aops;
> @@ -213,6 +210,8 @@ static int f2fs_create(struct inode *dir, struct dentry 
> *dentry, umode_t mode,
>       err = f2fs_add_link(dentry, inode);
>       if (err)
>               goto out;
> +     if (!test_opt(sbi, DISABLE_EXT_IDENTIFY))
> +             set_cold_files(sbi, inode, dentry->d_name.name);
>       f2fs_unlock_op(sbi);
>  
>       alloc_nid_done(sbi, ino);
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to