diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-03-29 15:30:40 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-04-02 09:56:27 +0900 |
commit | d54c795b495b9bd417e482286c832c9a8eb210ae (patch) | |
tree | d9cb8d56270bd124e7db2660d336d7afa1c7e6e7 /fs/f2fs/data.c | |
parent | 2d7b822ad9daf0ea903accacaa89340ddd3f201f (diff) | |
download | lwn-d54c795b495b9bd417e482286c832c9a8eb210ae.tar.gz lwn-d54c795b495b9bd417e482286c832c9a8eb210ae.zip |
f2fs: fix error path when fail to read inline data
We should unlock page in ->readpage() path and also should unlock & release page
in error path of ->write_begin() to avoid deadlock or memory leak.
So let's add release code to fix the problem when we fail to read inline data.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 598bfa617a7e..45abd60e2bff 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -942,13 +942,19 @@ inline_data: if (dn.data_blkaddr == NEW_ADDR) { zero_user_segment(page, 0, PAGE_CACHE_SIZE); } else { - if (f2fs_has_inline_data(inode)) + if (f2fs_has_inline_data(inode)) { err = f2fs_read_inline_data(inode, page); - else + if (err) { + page_cache_release(page); + return err; + } + } else { err = f2fs_submit_page_bio(sbi, page, dn.data_blkaddr, READ_SYNC); - if (err) - return err; + if (err) + return err; + } + lock_page(page); if (unlikely(!PageUptodate(page))) { f2fs_put_page(page, 1); |