f2fs: remove false-positive bug_on
Subsystems (2)
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: remove false-positive bug_on
If we got failure from both of create and evict_inode, we can hit this wrong bug_on.
--- fs/f2fs/inode.c | 2 -- 1 file changed, 2 deletions(-)
fs/f2fs/inode.c +0 -2
@@ -426,8 +426,6 @@ void f2fs_evict_inode(struct inode *inode)alloc_nid_failed (sbi, inode->i_ino);clear_inode_flag (inode,FI_FREE_NID ); } -f2fs_bug_on (sbi, err && - !exist_written_data (sbi, inode->i_ino,ORPHAN_INO )); out_clear:fscrypt_put_encryption_info (inode,NULL );clear_inode (inode);
Signature · 1 line
2.13.0.rc1.294.g07d810a77f-goog
Chao Yu
maintainerHi Jaegeuk,
Quoted 13 lines · Jaegeuk Kim
If we got failure from both of create and
evict_inode, we can hit this wrongbug_on.Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/inode.c | 2 -- 1 file changed, 2 deletions(-)fs/f2fs/inode.c +0
-0
fs/f2fs/inode.c void f2fs_evict_inode(struct inode *inode) · line 430
Quoted 5 lines
fs/f2fs/inode.c +0
-2@@ -426,8 +426,6 @@ void f2fs_evict_inode(struct inode *inode)alloc_nid_failed (sbi, inode->i_ino);clear_inode_flag (inode,FI_FREE_NID ); } -f2fs_bug_on (sbi, err && - !exist_written_data (sbi, inode->i_ino,ORPHAN_INO ));
We expect that we can keep the inode in orphan list in handle_failed_inode path when inode page have been persisted, so that if there is anything error in evice_inode, we can have another chance to release inode resource during next mount.
Here we need to check this case, additionally, if we failed to add the inode into orphan list in handle_failed_inode, we must have set SBI_NEED_FSCK in cp pack, so we need check the case too.
So we can change the code to:
f2fs_bug_on(err && err != -ENOENT &&
(!exist_written_data(sbi, inode->i_ino, ORPHAN_INO) || !is_sbi_flag_set(sbi, SBI_NEED_FSCK));
How do you think?
Thanks,
Quoted 4 lines
fs/f2fs/inode.c +0
-0out_clear:fscrypt_put_encryption_info (inode,NULL );clear_inode (inode);
Jaegeuk Kim
maintainerQuoted 31 lines · Chao Yu
Hi Jaegeuk,
Quoted 13 lines · Jaegeuk Kim
If we got failure from both of create and
evict_inode, we can hit this wrongbug_on.Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/inode.c | 2 -- 1 file changed, 2 deletions(-)fs/f2fs/inode.c +0
-0fs/f2fs/inode.c void f2fs_evict_inode(struct inode *inode) · line 430
Quoted 5 lines
fs/f2fs/inode.c +0
-2@@ -426,8 +426,6 @@ void f2fs_evict_inode(struct inode *inode)alloc_nid_failed (sbi, inode->i_ino);clear_inode_flag (inode,FI_FREE_NID ); } -f2fs_bug_on (sbi, err && - !exist_written_data (sbi, inode->i_ino,ORPHAN_INO ));We expect that we can keep the inode in orphan list in
handle_failed_inodepath when inode page have been persisted, so that if there is anything error inevice_inode, we can have another chance to release inode resource during next mount.Here we need to check this case, additionally, if we failed to add the inode into orphan list in
handle_failed_inode, we must have setSBI_NEED_FSCKin cp pack, so we need check the case too.
Quoted 5 lines
So we can change the code to:
f2fs_bug_on(err && err !=
-ENOENT&&(!exist_written_data(sbi, inode->i_ino, ORPHAN_INO) || !is_sbi_flag_set(sbi, SBI_NEED_FSCK));
Yup, I'll try this. ;)
Thanks,
Quoted 9 lines
How do you think?
Thanks,
Quoted 4 lines
fs/f2fs/inode.c +0
-0out_clear:fscrypt_put_encryption_info (inode,NULL );clear_inode (inode);
Quoted 32 lines · Jaegeuk Kim
Quoted 31 lines · Chao Yu
Hi Jaegeuk,
Quoted 13 lines · Jaegeuk Kim
If we got failure from both of create and
evict_inode, we can hit this wrongbug_on.Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/inode.c | 2 -- 1 file changed, 2 deletions(-)fs/f2fs/inode.c +0
-0fs/f2fs/inode.c void f2fs_evict_inode(struct inode *inode) · line 430
Quoted 5 lines
fs/f2fs/inode.c +0
-2@@ -426,8 +426,6 @@ void f2fs_evict_inode(struct inode *inode)alloc_nid_failed (sbi, inode->i_ino);clear_inode_flag (inode,FI_FREE_NID ); } -f2fs_bug_on (sbi, err && - !exist_written_data (sbi, inode->i_ino,ORPHAN_INO ));We expect that we can keep the inode in orphan list in
handle_failed_inodepath when inode page have been persisted, so that if there is anything error inevice_inode, we can have another chance to release inode resource during next mount.Here we need to check this case, additionally, if we failed to add the inode into orphan list in
handle_failed_inode, we must have setSBI_NEED_FSCKin cp pack, so we need check the case too.
Quoted 5 lines
Quoted 5 lines
So we can change the code to:
f2fs_bug_on(err && err !=
-ENOENT&&(!exist_written_data(sbi, inode->i_ino, ORPHAN_INO) || !is_sbi_flag_set(sbi, SBI_NEED_FSCK));
Oh, looks like it needs to use '&&' in between exist_written_data and is_sbi_flag_set. Could you fix this?
Thanks,
Quoted 17 lines
Yup, I'll try this. ;)
Thanks,
Quoted 9 lines
How do you think?
Thanks,
Quoted 4 lines
fs/f2fs/inode.c +0
-0out_clear:fscrypt_put_encryption_info (inode,NULL );clear_inode (inode);.
Jaegeuk Kim
maintainerFor example,
f2fs_create
- new_node_page is failed
- handle_failed_inode
- skip to add it into orphan list, since ni.blk_addr == NULL_ADDR : set_inode_flag(inode, FI_FREE_NID)
f2fs_evict_inode
- EIO due to fault injection
- f2fs_bug_on() is triggered
So, we don't need to call f2fs_bug_on in this case.
--- fs/f2fs/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/inode.c +3 -2
@@ -425,9 +425,10 @@ void f2fs_evict_inode(struct inode *inode)if (is_inode_flag_set (inode,FI_FREE_NID )) {alloc_nid_failed (sbi, inode->i_ino);clear_inode_flag (inode,FI_FREE_NID ); + }else { +f2fs_bug_on (sbi, err && + !exist_written_data (sbi, inode->i_ino,ORPHAN_INO )); } -f2fs_bug_on (sbi, err && - !exist_written_data (sbi, inode->i_ino,ORPHAN_INO )); out_clear:fscrypt_put_encryption_info (inode,NULL );clear_inode (inode);
Signature · 1 line
2.13.0.rc1.294.g07d810a77f-goog