diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index ea3cb29018e9..6b328de41728 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -259,8 +259,17 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index) if (PageUptodate(page)) return page; - BUG_ON(dn.data_blkaddr == NEW_ADDR); - BUG_ON(dn.data_blkaddr == NULL_ADDR); + /* + * A new dentry page is allocated but not able to be written, since its + * new inode page couldn't be allocated due to -ENOSPC. + * In such the case, its blkaddr can be remained as NEW_ADDR. + * see, f2fs_add_link -> get_new_data_page -> init_inode_metadata. + */ + if (dn.data_blkaddr == NEW_ADDR) { + zero_user_segment(page, 0, PAGE_CACHE_SIZE); + SetPageUptodate(page); + return page; + } err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); if (err)