f2fs: fix a infinite loop in writting checkpoint
PATCH 1/1 f2fs: fix a infinite loop in writting checkpoint
The loop reason is DIRTY IMETA always equal to 1:
Thread A:
-write_checkpoint
-block_operations
-f2fs_sync_inode_meta
-igrab <--- here igrab return NULL
Thread B:
-f2fs_evict_inode
-remove_inode_page
-truncate_xattr_node
-__get_node_page
-read_node_page <---- here return -ENOENT
This patch walk around this cause.
--- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/node.c +2 -1
@@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)return 0 ; npage =get_node_page (sbi, nid); -if (IS_ERR (npage)) +if (IS_ERR (npage) &&PTR_ERR (npage) != -ENOENT ) {return PTR_ERR (npage); + }f2fs_i_xnid_write (inode,0 );
Signature · 6 lines
1.9.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi Yunlei,
Quoted 8 lines · Yunlei He
The loop reason is DIRTY IMETA always equal to 1:
Thread A:
-write_checkpoint
-block_operations
-f2fs_sync_inode_meta
-igrab <--- here igrab return NULL
Quoted 8 lines
Thread B:
-f2fs_evict_inode
-remove_inode_page
-truncate_xattr_node
-__get_node_page
-read_node_page <---- here return-ENOENTThis patch walk around this cause.
It needs to figure out root cause that why xattr node entry is invalid.
Thanks,
Quoted 12 lines
Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/f2fs/node.c +0
-0
fs/f2fs/node.c int truncate_xattr_node(struct inode *inode, struct page *page) · line 981
Quoted 10 lines
fs/f2fs/node.c +2
-1@@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)return 0 ; npage =get_node_page (sbi, nid); -if (IS_ERR (npage)) +if (IS_ERR (npage) &&PTR_ERR (npage) != -ENOENT ) {return PTR_ERR (npage); + }f2fs_i_xnid_write (inode,0 );
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi Yunlei,
Quoted 8 lines · Yunlei He
The loop reason is DIRTY IMETA always equal to 1:
Thread A:
-write_checkpoint
-block_operations
-f2fs_sync_inode_meta
-igrab <--- here igrab return NULL
Quoted 8 lines
Thread B:
-f2fs_evict_inode
-remove_inode_page
-truncate_xattr_node
-__get_node_page
-read_node_page <---- here return-ENOENTThis patch walk around this cause.
It needs to figure out root cause that why xattr node entry is invalid.
How about this modification:
fs/f2fs/inode.c +1 -1
@@ -497,7 +497,7 @@ void f2fs_evict_inode(struct inode *inode)f2fs_lock_op (sbi); err =remove_inode_page (inode);f2fs_unlock_op (sbi); -if (err == -ENOENT ) +if (err == -ENOENT &&is_bad_inode (inode)) err =0 ; }
Thanks
Quoted 12 lines
Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/f2fs/node.c index 2654c91..ec7a0e0 renamed from fs/f2fs/node.c +0
-0100644
fs/f2fs/node.c int truncate_xattr_node(struct inode *inode, struct page *page) · line 981
Quoted 10 lines
fs/f2fs/node.c +2
-1@@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)return 0 ; npage =get_node_page (sbi, nid); -if (IS_ERR (npage)) +if (IS_ERR (npage) &&PTR_ERR (npage) != -ENOENT ) {return PTR_ERR (npage); + }f2fs_i_xnid_write (inode,0 );
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Quoted 30 lines · heyunlei
Hi Yunlei,
Quoted 8 lines · Yunlei He
The loop reason is DIRTY IMETA always equal to 1:
Thread A:
-write_checkpoint
-block_operations
-f2fs_sync_inode_meta
-igrab <--- here igrab return NULLQuoted 8 lines
Thread B:
-f2fs_evict_inode
-remove_inode_page
-truncate_xattr_node
-__get_node_page
-read_node_page <---- here return-ENOENTThis patch walk around this cause.
It needs to figure out root cause that why xattr node entry is invalid.
How about this modification:
fs/f2fs/inode.c +0
-0
fs/f2fs/inode.c void f2fs_evict_inode(struct inode *inode) · line 500
Quoted 5 lines
fs/f2fs/inode.c +1
-1@@ -497,7 +497,7 @@ void f2fs_evict_inode(struct inode *inode)f2fs_lock_op (sbi); err =remove_inode_page (inode);f2fs_unlock_op (sbi); -if (err == -ENOENT ) +if (err == -ENOENT &&is_bad_inode (inode))
So we expect that before new inode page was allocated, it needs to set bad inode in time covering all error paths?
Thanks,
Quoted 24 lines
fs/f2fs/inode.c +0
-0err =0 ; }Thanks
Quoted 19 lines
Signed-off-by Yunlei He <[email protected]>--- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/f2fs/node.c index 2654c91..ec7a0e0 renamed from fs/f2fs/node.c +0
-0100644
fs/f2fs/node.c +2
-1@@ -973,8 +973,9 @@ int truncate_xattr_node(struct inode *inode, struct page *page)return 0 ; npage =get_node_page (sbi, nid); -if (IS_ERR (npage)) +if (IS_ERR (npage) &&PTR_ERR (npage) != -ENOENT ) {return PTR_ERR (npage); + }
Quoted 4 lines
fs/f2fs/node.c int truncate_xattr_node(struct inode *inode, struct page *page) · line 981
Quoted 3 lines
fs/f2fs/node.c +0
-0f2fs_i_xnid_write (inode,0 );
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot