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

f2fs: avoid to truncate non-updated page partially

After we call find_data_page in truncate_partial_data_page, we could not
guarantee this page is updated or not as error may occurred in lower layer.

We'd better check status of the page to avoid this no updated page be
writebacked to device.
Signed-off-by: default avatarChao Yu <>
Signed-off-by: default avatarJaegeuk Kim <>
parent 5576cd6c
...@@ -380,13 +380,15 @@ static void truncate_partial_data_page(struct inode *inode, u64 from) ...@@ -380,13 +380,15 @@ static void truncate_partial_data_page(struct inode *inode, u64 from)
return; return;
lock_page(page); lock_page(page);
if (unlikely(page->mapping != inode->i_mapping)) { if (unlikely(!PageUptodate(page) ||
f2fs_put_page(page, 1); page->mapping != inode->i_mapping))
return; goto out;
f2fs_wait_on_page_writeback(page, DATA); f2fs_wait_on_page_writeback(page, DATA);
zero_user(page, offset, PAGE_CACHE_SIZE - offset); zero_user(page, offset, PAGE_CACHE_SIZE - offset);
set_page_dirty(page); set_page_dirty(page);
f2fs_put_page(page, 1); f2fs_put_page(page, 1);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment