Re: [f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-08 Thread Sheng Yong




On 2018/7/9 10:15, Chao Yu wrote:

Hi Sheng,

On 2018/7/3 18:10, Sheng Yong wrote:

Check extra_attr feature for inode. If it is corrupted, remove the
inode.


Could you check the patch:

[PATCH] fsck.f2fs: fix to do sanity check with extra_attr feature

Would it better to do sanity check with it in fsck_chk_inode_blk? since it is
about consistence of inode instead of nid.



Agree. And the patch has already checked the value of i_extra_isize, so this one
can be dropped :-)

Thanks


Thanks,



Link: https://bugzilla.kernel.org/show_bug.cgi?id=200219
Reported-by: Wen Xu 
Signed-off-by: Sheng Yong 
---
  fsck/fsck.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 15264b2..acbe25d 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -460,6 +460,12 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 
nid,
__check_inode_mode(nid, ftype, le32_to_cpu(node_blk->i.i_mode)))
return -EINVAL;
  
+	if (ntype == TYPE_INODE &&

+   ((f2fs_has_extra_isize(_blk->i) &&
+ !(c.feature & F2FS_FEATURE_EXTRA_ATTR)) ||
+get_extra_isize(node_blk) >= DEF_ADDRS_PER_INODE))
+   return -EINVAL;
+
/* workaround to fix later */
if (ftype != F2FS_FT_ORPHAN ||
f2fs_test_bit(nid, fsck->nat_area_bitmap) != 0) {




.




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-08 Thread Chao Yu
Hi Sheng,

On 2018/7/3 18:10, Sheng Yong wrote:
> Check extra_attr feature for inode. If it is corrupted, remove the
> inode.

Could you check the patch:

[PATCH] fsck.f2fs: fix to do sanity check with extra_attr feature

Would it better to do sanity check with it in fsck_chk_inode_blk? since it is
about consistence of inode instead of nid.

Thanks,

> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=200219
> Reported-by: Wen Xu 
> Signed-off-by: Sheng Yong 
> ---
>  fsck/fsck.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fsck/fsck.c b/fsck/fsck.c
> index 15264b2..acbe25d 100644
> --- a/fsck/fsck.c
> +++ b/fsck/fsck.c
> @@ -460,6 +460,12 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, 
> u32 nid,
>   __check_inode_mode(nid, ftype, le32_to_cpu(node_blk->i.i_mode)))
>   return -EINVAL;
>  
> + if (ntype == TYPE_INODE &&
> + ((f2fs_has_extra_isize(_blk->i) &&
> +   !(c.feature & F2FS_FEATURE_EXTRA_ATTR)) ||
> +  get_extra_isize(node_blk) >= DEF_ADDRS_PER_INODE))
> + return -EINVAL;
> +
>   /* workaround to fix later */
>   if (ftype != F2FS_FT_ORPHAN ||
>   f2fs_test_bit(nid, fsck->nat_area_bitmap) != 0) {
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 2/2] fsck.f2fs: check extra_attr feature

2018-07-03 Thread Sheng Yong
Check extra_attr feature for inode. If it is corrupted, remove the
inode.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=200219
Reported-by: Wen Xu 
Signed-off-by: Sheng Yong 
---
 fsck/fsck.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 15264b2..acbe25d 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -460,6 +460,12 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 
nid,
__check_inode_mode(nid, ftype, le32_to_cpu(node_blk->i.i_mode)))
return -EINVAL;
 
+   if (ntype == TYPE_INODE &&
+   ((f2fs_has_extra_isize(_blk->i) &&
+ !(c.feature & F2FS_FEATURE_EXTRA_ATTR)) ||
+get_extra_isize(node_blk) >= DEF_ADDRS_PER_INODE))
+   return -EINVAL;
+
/* workaround to fix later */
if (ftype != F2FS_FT_ORPHAN ||
f2fs_test_bit(nid, fsck->nat_area_bitmap) != 0) {
-- 
2.17.1


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel