aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-06-12 01:31:50 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-07-09 17:04:24 -0400
commitca0a81b397b5f153ac2a9880c5e85b08b0447e4e (patch)
treeff170cf8dce25ce8655ecd8490af530cfb409df0 /fs/f2fs/file.c
parent5576cd6ca555bd79e76a2d798aec44b28851d369 (diff)
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: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 7d8b96275092..36fa50587bb8 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -380,13 +380,15 @@ static void truncate_partial_data_page(struct inode *inode, u64 from)
380 return; 380 return;
381 381
382 lock_page(page); 382 lock_page(page);
383 if (unlikely(page->mapping != inode->i_mapping)) { 383 if (unlikely(!PageUptodate(page) ||
384 f2fs_put_page(page, 1); 384 page->mapping != inode->i_mapping))
385 return; 385 goto out;
386 } 386
387 f2fs_wait_on_page_writeback(page, DATA); 387 f2fs_wait_on_page_writeback(page, DATA);
388 zero_user(page, offset, PAGE_CACHE_SIZE - offset); 388 zero_user(page, offset, PAGE_CACHE_SIZE - offset);
389 set_page_dirty(page); 389 set_page_dirty(page);
390
391out:
390 f2fs_put_page(page, 1); 392 f2fs_put_page(page, 1);
391} 393}
392 394