• Chao Yu's avatar
    f2fs: fix error path in init_inode_metadata · 90d72459
    Chao Yu authored
    If we fail in this path:
    ->init_inode_metadata
      ->make_empty_dir
        ->get_new_data_page
          ->grab_cache_page return -ENOMEM
    
    We will bug on in error path of init_inode_metadata when call remove_inode_page
    because i_block = 2 (one inode block will be released later & one dentry block).
    
    We should release the dentry block in init_inode_metadata to avoid this BUG_ON,
    and avoid leak of dentry block resource, because we never have second chance to
    release that block in ->evict_inode as in upper error path we make this inode
    'bad'.
    Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    90d72459
dir.c 17.1 KB