summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-08-23 06:18:00 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2018-09-05 22:41:07 +0200
commit0ded69f632bb717be9aeea3ae74e29050fcb060c (patch)
tree2e163c4d4d623d41c061f5884fe405bd71c0b050 /fs/f2fs/segment.c
parentRevert "f2fs: use printk_ratelimited for f2fs_msg" (diff)
downloadlinux-0ded69f632bb717be9aeea3ae74e29050fcb060c.tar.xz
linux-0ded69f632bb717be9aeea3ae74e29050fcb060c.zip
f2fs: avoid wrong decrypted data from disk
1. Create a file in an encrypted directory 2. Do GC & drop caches 3. Read stale data before its bio for metapage was not issued yet Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to '')
-rw-r--r--fs/f2fs/segment.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 34e05777941e..187c848a65b8 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3195,10 +3195,14 @@ void f2fs_wait_on_page_writeback(struct page *page,
}
}
-void f2fs_wait_on_block_writeback(struct f2fs_sb_info *sbi, block_t blkaddr)
+void f2fs_wait_on_block_writeback(struct inode *inode, block_t blkaddr)
{
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct page *cpage;
+ if (!f2fs_post_read_required(inode))
+ return;
+
if (!is_valid_data_blkaddr(sbi, blkaddr))
return;