f2fs: handle quota for orphan inodes
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: handle quota for orphan inodes
This is to fix missing dquot_initialize for orphan inodes.
--- fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
fs/f2fs/checkpoint.c +16 -12
@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)struct node_info ni;int err =acquire_orphan_inode (sbi); -if (err) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x), run fsck to fix." , - __func__, ino); -return err; - } +if (err) + goto err_out;__add_ino_entry (sbi, ino,0 ,ORPHAN_INO );
@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)return PTR_ERR (inode); } + err =dquot_initialize (inode); +if (err) + goto err_out; + +dquot_initialize (inode);clear_nlink (inode);/* truncate all the data during iput */
@@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)/* ENOMEM was fully retried in f2fs_evict_inode. */ if (ni.blk_addr !=NULL_ADDR ) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x) by kernel, retry mount." , - __func__, ino); -return -EIO ; + err = -EIO ; + goto err_out; }__remove_ino_entry (sbi, ino,ORPHAN_INO );return 0 ; + +err_out: +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_msg (sbi->sb,KERN_WARNING , +"%s: orphan failed (ino=%x), run fsck to fix." , + __func__, ino); +return err; }int recover_orphan_inodes (struct f2fs_sb_info *sbi)
Signature · 1 line
2.15.0.531.g2ccb3012c9-goog
Chao Yu
maintainerQuoted 1 line · Jaegeuk Kim
This is to fix missing
dquot_initializefor orphan inodes.
IMO, we don't need to call dquot_initialize as we have call the function in evict(), right?
Thanks,
Quoted 63 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)fs/f2fs/checkpoint.c +16
-12@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)struct node_info ni;int err =acquire_orphan_inode (sbi); -if (err) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x), run fsck to fix." , - __func__, ino); -return err; - } +if (err) + goto err_out;__add_ino_entry (sbi, ino,0 ,ORPHAN_INO );@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)return PTR_ERR (inode); } + err =dquot_initialize (inode); +if (err) + goto err_out; + +dquot_initialize (inode);clear_nlink (inode);/* truncate all the data during iput */ @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)/* ENOMEM was fully retried in f2fs_evict_inode. */ if (ni.blk_addr !=NULL_ADDR ) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x) by kernel, retry mount." , - __func__, ino); -return -EIO ; + err = -EIO ; + goto err_out; }__remove_ino_entry (sbi, ino,ORPHAN_INO );return 0 ; + +err_out: +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_msg (sbi->sb,KERN_WARNING , +"%s: orphan failed (ino=%x), run fsck to fix." , + __func__, ino); +return err; }int recover_orphan_inodes (struct f2fs_sb_info *sbi)
Ping,
Quoted 74 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim
This is to fix missing
dquot_initializefor orphan inodes.IMO, we don't need to call
dquot_initializeas we have call the function inevict(), right?Thanks,
Quoted 53 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)fs/f2fs/checkpoint.c +9
-12@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)struct node_info ni;int err =acquire_orphan_inode (sbi); -if (err) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x), run fsck to fix." , - __func__, ino); -return err; - } +if (err) + goto err_out;__add_ino_entry (sbi, ino,0 ,ORPHAN_INO );@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)return PTR_ERR (inode); } + err =dquot_initialize (inode); +if (err) + goto err_out; + +dquot_initialize (inode);clear_nlink (inode);/* truncate all the data during iput */ @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)/* ENOMEM was fully retried in f2fs_evict_inode. */ if (ni.blk_addr !=NULL_ADDR ) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x) by kernel, retry mount." , - __func__, ino); -return -EIO ; + err = -EIO ; + goto err_out; }__remove_ino_entry (sbi, ino,ORPHAN_INO );return 0 ;fs/f2fs/checkpoint.c static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) · line 615
Quoted 10 lines
fs/f2fs/checkpoint.c +7
-0+ +err_out: +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_msg (sbi->sb,KERN_WARNING , +"%s: orphan failed (ino=%x), run fsck to fix." , + __func__, ino); +return err; }int recover_orphan_inodes (struct f2fs_sb_info *sbi).
Jaegeuk Kim
maintainerQuoted 8 lines · Chao Yu
Ping,
Quoted 5 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim
This is to fix missing
dquot_initializefor orphan inodes.IMO, we don't need to call
dquot_initializeas we have call the function inevict(), right?
I think we'd better detect any error in early stage.
Thanks,
Quoted 69 lines
Quoted 69 lines
Thanks,
Quoted 53 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)fs/f2fs/checkpoint.c +9
-12@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)struct node_info ni;int err =acquire_orphan_inode (sbi); -if (err) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x), run fsck to fix." , - __func__, ino); -return err; - } +if (err) + goto err_out;__add_ino_entry (sbi, ino,0 ,ORPHAN_INO );@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)return PTR_ERR (inode); } + err =dquot_initialize (inode); +if (err) + goto err_out; + +dquot_initialize (inode);clear_nlink (inode);/* truncate all the data during iput */ @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)/* ENOMEM was fully retried in f2fs_evict_inode. */ if (ni.blk_addr !=NULL_ADDR ) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x) by kernel, retry mount." , - __func__, ino); -return -EIO ; + err = -EIO ; + goto err_out; }__remove_ino_entry (sbi, ino,ORPHAN_INO );return 0 ;fs/f2fs/checkpoint.c static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) · line 615
Quoted 10 lines
fs/f2fs/checkpoint.c +7
-0+ +err_out: +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_msg (sbi->sb,KERN_WARNING , +"%s: orphan failed (ino=%x), run fsck to fix." , + __func__, ino); +return err; }int recover_orphan_inodes (struct f2fs_sb_info *sbi).
Chao Yu
Reviewed-byQuoted 11 lines · Jaegeuk Kim
Quoted 8 lines · Chao Yu
Ping,
Quoted 5 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim
This is to fix missing
dquot_initializefor orphan inodes.IMO, we don't need to call
dquot_initializeas we have call the function inevict(), right?I think we'd better detect any error in early stage.
Oh, agreed, in evict(), we can not detect or handle the error of dquot_initialize, how about changing commit log a bit to indicate that, anyway, the change looks good to me. ;)
Thanks,
Quoted 75 lines
Thanks,
Quoted 64 lines
Quoted 64 lines
Thanks,
Quoted 61 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/checkpoint.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)fs/f2fs/checkpoint.c +16
-12@@ -569,13 +569,8 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)struct node_info ni;int err =acquire_orphan_inode (sbi); -if (err) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x), run fsck to fix." , - __func__, ino); -return err; - } +if (err) + goto err_out;__add_ino_entry (sbi, ino,0 ,ORPHAN_INO );@@ -589,6 +584,11 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)return PTR_ERR (inode); } + err =dquot_initialize (inode); +if (err) + goto err_out; + +dquot_initialize (inode);clear_nlink (inode);/* truncate all the data during iput */ @@ -598,14 +598,18 @@ static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)/* ENOMEM was fully retried in f2fs_evict_inode. */ if (ni.blk_addr !=NULL_ADDR ) { -set_sbi_flag (sbi,SBI_NEED_FSCK ); -f2fs_msg (sbi->sb,KERN_WARNING , -"%s: orphan failed (ino=%x) by kernel, retry mount." , - __func__, ino); -return -EIO ; + err = -EIO ; + goto err_out; }__remove_ino_entry (sbi, ino,ORPHAN_INO );return 0 ; + +err_out: +set_sbi_flag (sbi,SBI_NEED_FSCK ); +f2fs_msg (sbi->sb,KERN_WARNING , +"%s: orphan failed (ino=%x), run fsck to fix." , + __func__, ino); +return err; }Quoted 5 lines
Quoted 5 lines
fs/f2fs/checkpoint.c static int recover_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) · line 615
Quoted 2 lines
fs/f2fs/checkpoint.c +0
-0int recover_orphan_inodes (struct f2fs_sb_info *sbi).
.