f2fs: wait writeback before reading data to avoid stale encrypted block
Subsystems (2)
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: wait writeback before reading data to avoid stale encrypted block
If background GC is running very frequently by gc_urgent, the next GC can see unwritten data generated by the previous GC, which incurs to write stale corrupted data in disk.
Cc <[email protected]>
Signed-off-by Jaegeuk Kim <[email protected]>
--- fs/f2fs/gc.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/f2fs/gc.c +6 -0
@@ -658,6 +658,9 @@ static int ra_data_block(struct inode *inode, pgoff_t index) fio.page = page; fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; +/* wait writeback before reading out */ +f2fs_wait_on_block_writeback (inode, dn.data_blkaddr); + fio.encrypted_page =f2fs_pagecache_get_page (META_MAPPING (sbi), dn.data_blkaddr,FGP_LOCK |FGP_CREAT ,GFP_NOFS );
@@ -755,6 +758,9 @@ static int move_data_block(struct inode *inode, block_t bidx, fio.page = page; fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; +/* wait writeback before reading out */ +f2fs_wait_on_block_writeback (inode, fio.old_blkaddr); +if (lfs_mode)down_write (&fio.sbi->io_order_lock);
Signature · 1 line
2.19.0.605.g01d371f741-goog
Jaegeuk Kim
maintainerLet me drop this, since I missed there was a patch to introdcued this. :)
Quoted 36 lines · Jaegeuk Kim
If background GC is running very frequently by
gc_urgent, the next GC can see unwritten data generated by the previous GC, which incurs to write stale corrupted data in disk.Cc <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/gc.c | 6 ++++++ 1 file changed, 6 insertions(+)fs/f2fs/gc.c +6
-0@@ -658,6 +658,9 @@ static int ra_data_block(struct inode *inode, pgoff_t index) fio.page = page; fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; +/* wait writeback before reading out */ +f2fs_wait_on_block_writeback (inode, dn.data_blkaddr); + fio.encrypted_page =f2fs_pagecache_get_page (META_MAPPING (sbi), dn.data_blkaddr,FGP_LOCK |FGP_CREAT ,GFP_NOFS );@@ -755,6 +758,9 @@ static int move_data_block(struct inode *inode, block_t bidx, fio.page = page; fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr; +/* wait writeback before reading out */ +f2fs_wait_on_block_writeback (inode, fio.old_blkaddr); +if (lfs_mode)down_write (&fio.sbi->io_order_lock);Signature · 1 line
2.19.0.605.g01d371f741-goog