mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
f2fs: handle error cases in move_encrypted_block
This patch fixes some missing error handlers. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
33b40178cb
commit
548aedac51
1 changed files with 16 additions and 9 deletions
25
fs/f2fs/gc.c
25
fs/f2fs/gc.c
|
@ -556,27 +556,34 @@ static void move_encrypted_block(struct inode *inode, block_t bidx)
|
||||||
if (!fio.encrypted_page)
|
if (!fio.encrypted_page)
|
||||||
goto put_out;
|
goto put_out;
|
||||||
|
|
||||||
f2fs_submit_page_bio(&fio);
|
err = f2fs_submit_page_bio(&fio);
|
||||||
|
if (err)
|
||||||
/* allocate block address */
|
goto put_page_out;
|
||||||
f2fs_wait_on_page_writeback(dn.node_page, NODE);
|
|
||||||
|
|
||||||
allocate_data_block(fio.sbi, NULL, fio.blk_addr,
|
|
||||||
&fio.blk_addr, &sum, CURSEG_COLD_DATA);
|
|
||||||
dn.data_blkaddr = fio.blk_addr;
|
|
||||||
|
|
||||||
/* write page */
|
/* write page */
|
||||||
lock_page(fio.encrypted_page);
|
lock_page(fio.encrypted_page);
|
||||||
|
|
||||||
|
if (unlikely(!PageUptodate(fio.encrypted_page)))
|
||||||
|
goto put_page_out;
|
||||||
|
if (unlikely(fio.encrypted_page->mapping != META_MAPPING(fio.sbi)))
|
||||||
|
goto put_page_out;
|
||||||
|
|
||||||
set_page_writeback(fio.encrypted_page);
|
set_page_writeback(fio.encrypted_page);
|
||||||
|
|
||||||
|
/* allocate block address */
|
||||||
|
f2fs_wait_on_page_writeback(dn.node_page, NODE);
|
||||||
|
allocate_data_block(fio.sbi, NULL, fio.blk_addr,
|
||||||
|
&fio.blk_addr, &sum, CURSEG_COLD_DATA);
|
||||||
fio.rw = WRITE_SYNC;
|
fio.rw = WRITE_SYNC;
|
||||||
f2fs_submit_page_mbio(&fio);
|
f2fs_submit_page_mbio(&fio);
|
||||||
|
|
||||||
|
dn.data_blkaddr = fio.blk_addr;
|
||||||
set_data_blkaddr(&dn);
|
set_data_blkaddr(&dn);
|
||||||
f2fs_update_extent_cache(&dn);
|
f2fs_update_extent_cache(&dn);
|
||||||
set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE);
|
set_inode_flag(F2FS_I(inode), FI_APPEND_WRITE);
|
||||||
if (page->index == 0)
|
if (page->index == 0)
|
||||||
set_inode_flag(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN);
|
set_inode_flag(F2FS_I(inode), FI_FIRST_BLOCK_WRITTEN);
|
||||||
|
put_page_out:
|
||||||
f2fs_put_page(fio.encrypted_page, 1);
|
f2fs_put_page(fio.encrypted_page, 1);
|
||||||
put_out:
|
put_out:
|
||||||
f2fs_put_dnode(&dn);
|
f2fs_put_dnode(&dn);
|
||||||
|
|
Loading…
Reference in a new issue