Commit 06c7540f authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: fix to avoid using uninitialized variable



In f2fs_vm_page_mkwrite(), if inode is compress one, and current mmapped
page locates in compressed cluster, we have to call f2fs_get_dnode_of_data()
to get its physical block address before f2fs_wait_on_block_writeback().

Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 7a88ddb5
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -106,11 +106,19 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf)
		err = f2fs_get_block(&dn, page->index);
		f2fs_put_dnode(&dn);
		__do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, false);
	}

#ifdef CONFIG_F2FS_FS_COMPRESSION
	if (!need_alloc) {
		set_new_dnode(&dn, inode, NULL, NULL, 0);
		err = f2fs_get_dnode_of_data(&dn, page->index, LOOKUP_NODE);
		f2fs_put_dnode(&dn);
	}
#endif
	if (err) {
		unlock_page(page);
		goto out_sem;
	}
	}

	f2fs_wait_on_page_writeback(page, DATA, false, true);