f2fs: add a missing truncate_inode_pages_final
PATCH 1/2 f2fs: add a missing truncate_inode_pages_final
This patch add a missing truncate_inode_pages_final
--- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/super.c +2 -0
@@ -642,6 +642,8 @@ static int f2fs_drop_inode(struct inode *inode)if (f2fs_is_atomic_file (inode))drop_inmem_pages (inode); +truncate_inode_pages_final (&inode->i_data); +/* should remain fi->extent_tree for writepage */ f2fs_destroy_extent_node (inode);
Signature · 9 lines
2.10.1 ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford
PATCH 2/2 f2fs: avoid move encrypted block in BG_GC if it has been in memory
If an encrypted block has been read to memory, we just dirty it and return directly.
--- fs/f2fs/gc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +9 -2
@@ -564,7 +564,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, }static void move_encrypted_block (struct inode *inode,block_t bidx, -unsigned int segno,int off) +int gc_type,unsigned int segno,int off) {struct f2fs_io_info fio = { .sbi =F2FS_I_SB (inode),
@@ -607,6 +607,12 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,*/ f2fs_wait_on_page_writeback (page,DATA , true); +if (gc_type ==BG_GC &&PageUptodate (page) && +fscrypt_has_encryption_key (inode)) { +set_page_dirty (page); + goto put_out; + } +get_node_info (fio.sbi, dn.nid, &ni);set_summary (&sum, dn.nid, dn.ofs_in_node, ni.version);
@@ -827,7 +833,8 @@ static void gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, start_bidx =start_bidx_of_node (nofs, inode) + ofs_in_node;if (f2fs_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) -move_encrypted_block (inode, start_bidx, segno, off); +move_encrypted_block (inode, start_bidx, + gc_type, segno, off);else move_data_page (inode, start_bidx, gc_type, segno, off);
Signature · 9 lines
2.10.1 ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford
Jaegeuk Kim
maintainerRe: [PATCH 2/2] f2fs: avoid move encrypted block in BG_GC if it has been in memory
Quoted 22 lines · Yunlei He
If an encrypted block has been read to memory, we just dirty it and return directly.
Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/gc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)fs/f2fs/gc.c +1
-1@@ -564,7 +564,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, }static void move_encrypted_block (struct inode *inode,block_t bidx, -unsigned int segno,int off) +int gc_type,unsigned int segno,int off) {struct f2fs_io_info fio = { .sbi =F2FS_I_SB (inode),
fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 611
Quoted 5 lines
fs/f2fs/gc.c +2
-0@@ -607,6 +607,12 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,*/ f2fs_wait_on_page_writeback (page,DATA , true); +if (gc_type ==BG_GC &&PageUptodate (page) && +fscrypt_has_encryption_key (inode)) {
Why do we need the encryption key?
Thanks,
Quoted 31 lines
fs/f2fs/gc.c +6
-1+set_page_dirty (page); + goto put_out; + } +get_node_info (fio.sbi, dn.nid, &ni);set_summary (&sum, dn.nid, dn.ofs_in_node, ni.version);@@ -827,7 +833,8 @@ static void gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, start_bidx =start_bidx_of_node (nofs, inode) + ofs_in_node;if (f2fs_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) -move_encrypted_block (inode, start_bidx, segno, off); +move_encrypted_block (inode, start_bidx, + gc_type, segno, off);else move_data_page (inode, start_bidx, gc_type, segno, off);Signature · 13 lines
2.10.1 ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 2/2] f2fs: avoid move encrypted block in BG_GC if it has been in memory
Hi Jaegeuk,
Quoted 26 lines · Jaegeuk Kim
Quoted 25 lines · Yunlei He
If an encrypted block has been read to memory, we just dirty it and return directly.
Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/gc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)fs/f2fs/gc.c +1
-1@@ -564,7 +564,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, }static void move_encrypted_block (struct inode *inode,block_t bidx, -unsigned int segno,int off) +int gc_type,unsigned int segno,int off) {struct f2fs_io_info fio = { .sbi =F2FS_I_SB (inode),@@ -607,6 +607,12 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,*/ f2fs_wait_on_page_writeback (page,DATA , true);
Quoted 4 lines
fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 611
Quoted 2 lines
fs/f2fs/gc.c +2
-0+if (gc_type ==BG_GC &&PageUptodate (page) && +fscrypt_has_encryption_key (inode)) {Why do we need the encryption key?
Here I am afraid some cases dirty encrypted pages have no authority to write back.
Thanks.
Quoted 24 lines
Thanks,
Quoted 21 lines
fs/f2fs/gc.c +6
-2+set_page_dirty (page); + goto put_out; + } +get_node_info (fio.sbi, dn.nid, &ni);set_summary (&sum, dn.nid, dn.ofs_in_node, ni.version);@@ -827,7 +833,8 @@ static void gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, start_bidx =start_bidx_of_node (nofs, inode) + ofs_in_node;if (f2fs_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) -move_encrypted_block (inode, start_bidx, segno, off); +move_encrypted_block (inode, start_bidx, + gc_type, segno, off);else move_data_page (inode, start_bidx, gc_type, segno, off); --2.10.1
Quoted 13 lines
Quoted 10 lines
------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Re: [PATCH 2/2] f2fs: avoid move encrypted block in BG_GC if it has been in memory
Quoted 29 lines · heyunlei
Hi Jaegeuk,
Quoted 26 lines · Jaegeuk Kim
Quoted 25 lines · Yunlei He
If an encrypted block has been read to memory, we just dirty it and return directly.
Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/gc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)fs/f2fs/gc.c +1
-1@@ -564,7 +564,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, }static void move_encrypted_block (struct inode *inode,block_t bidx, -unsigned int segno,int off) +int gc_type,unsigned int segno,int off) {struct f2fs_io_info fio = { .sbi =F2FS_I_SB (inode),@@ -607,6 +607,12 @@ static void move_encrypted_block(struct inode *inode, block_t bidx,*/ f2fs_wait_on_page_writeback (page,DATA , true);
Quoted 6 lines
Quoted 4 lines
fs/f2fs/gc.c static void move_encrypted_block(struct inode *inode, block_t bidx, · line 611
Quoted 2 lines
fs/f2fs/gc.c +2
-0+if (gc_type ==BG_GC &&PageUptodate (page) && +fscrypt_has_encryption_key (inode)) {Why do we need the encryption key?
Here I am afraid some cases dirty encrypted pages have no authority to write back.
Not sure this is the right way, I suspect that user may change master key to incorrect one in keyring, then, this approach will make original data in page cache being encrypted with the wrong key and writebacked to storage even if user only have read permission?
Thanks,
Quoted 41 lines
Thanks.
Quoted 24 lines
Thanks,
Quoted 21 lines
fs/f2fs/gc.c +6
-2+set_page_dirty (page); + goto put_out; + } +get_node_info (fio.sbi, dn.nid, &ni);set_summary (&sum, dn.nid, dn.ofs_in_node, ni.version);@@ -827,7 +833,8 @@ static void gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, start_bidx =start_bidx_of_node (nofs, inode) + ofs_in_node;if (f2fs_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) -move_encrypted_block (inode, start_bidx, segno, off); +move_encrypted_block (inode, start_bidx, + gc_type, segno, off);else move_data_page (inode, start_bidx, gc_type, segno, off); --2.10.1
Quoted 13 lines
Quoted 10 lines
------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel.
Quoted 2 lines
.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Jaegeuk Kim
maintainerHi Yunlei,
I just hit this, so will pop the patch out.
[ 870.158785] sysrq: SysRq : Show Blocked State [ 870.158991] task PC stack pid father [ 870.159024] kworker/u8:2 D 0 127 2 0x00000000 [ 870.159033] Workqueue: writeback wb_workfn (flush-8:32) [ 870.159036] Call Trace: [ 870.159042] __schedule+0x28e/0x8d0 [ 870.159045] schedule+0x36/0x80 [ 870.159049] io_schedule+0x16/0x40 [ 870.159052] wait_on_page_bit+0xf7/0x130 [ 870.159054] ? page_cache_tree_insert+0x120/0x120 [ 870.159057] truncate_inode_pages_range+0x4b0/0x930 [ 870.159063] truncate_inode_pages_final+0x4d/0x60 [ 870.159073] f2fs_drop_inode+0x1a0/0x290 [f2fs] [ 870.159075] iput+0xf0/0x230 [ 870.159083] f2fs_sync_inode_meta+0x3f/0x100 [f2fs] [ 870.159090] block_operations+0xfc/0x200 [f2fs] [ 870.159097] ? f2fs_inode_dirtied+0x62/0xd0 [f2fs] [ 870.159106] ? __insert_extent_tree+0xc0/0xf0 [f2fs] [ 870.159113] write_checkpoint+0x9d/0xe50 [f2fs] [ 870.159121] f2fs_gc+0x398/0x480 [f2fs] [ 870.159129] ? write_data_page+0x68/0x90 [f2fs] [ 870.159137] f2fs_balance_fs+0x132/0x150 [f2fs] [ 870.159145] __write_data_page+0x111/0x5c0 [f2fs] [ 870.159153] f2fs_write_cache_pages+0x23a/0x4a0 [f2fs] [ 870.159160] f2fs_write_data_pages+0x9b/0x1d0 [f2fs] [ 870.159162] ? set_page_dirty+0x5b/0xb0 [ 870.159204] ? update_inode+0x273/0x2e0 [f2fs] [ 870.159206] do_writepages+0x1e/0x30 [ 870.159208] __writeback_single_inode+0x45/0x320 [ 870.159211] writeback_sb_inodes+0x266/0x5f0 [ 870.159213] __writeback_inodes_wb+0x92/0xc0 [ 870.159215] wb_writeback+0x268/0x300 [ 870.159217] ? get_nr_dirty_inodes+0x4c/0x70 [ 870.159219] wb_workfn+0x2df/0x410 [ 870.159221] process_one_work+0x1fc/0x4b0 [ 870.159223] worker_thread+0x4b/0x500 [ 870.159224] kthread+0x101/0x140 [ 870.159226] ? process_one_work+0x4b0/0x4b0 [ 870.159227] ? kthread_create_on_node+0x60/0x60 [ 870.159229] ret_from_fork+0x2c/0x40 [ 870.159269] fsstress D 0 3329 3328 0x000000
Thanks,
Quoted 34 lines · Yunlei He
This patch add a missing
truncate_inode_pages_finalSigned-off-by Yunlei He <[email protected]>--- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+)fs/f2fs/super.c +2
-0@@ -642,6 +642,8 @@ static int f2fs_drop_inode(struct inode *inode)if (f2fs_is_atomic_file (inode))drop_inmem_pages (inode); +truncate_inode_pages_final (&inode->i_data); +/* should remain fi->extent_tree for writepage */ f2fs_destroy_extent_node (inode);Signature · 13 lines
2.10.1 ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot