Skip to contentSkip to conversation

fsck.f2fs: check only max extra_isize

PATCH In review Jaegeuk Kim 3 participants 4 messages Aug 17, 2019 – Aug 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck.f2fs: check only max extra_isize

If we use later kernel having larger extra_isize, old fsck will delete entire old files.

---
 fsck/fsck.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/fsck.c +1 -1
index 1708abe..b4e53db 100644
@@ -731,7 +731,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
 	if (f2fs_has_extra_isize(&node_blk->i)) {
 		if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {
 			if (node_blk->i.i_extra_isize >
-				cpu_to_le16(F2FS_TOTAL_EXTRA_ATTR_SIZE)) {
+						4 * DEF_ADDRS_PER_INODE) {
 				FIX_MSG("ino[0x%x] recover i_extra_isize "
 					"from %u to %u",
 					nid,
Signature · 8 lines
2.19.0.605.g01d371f741-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw
Quoted 2 lines · Jaegeuk Kim

If we use later kernel having larger extra_isize, old fsck will delete entire old files.

Would it be better to construct the length based on existed features?

Thanks,

Quoted 12 lines
---
 fsck/fsck.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/fsck.c +0 -0
index 1708abe..b4e53db 100644

fsck/fsck.c void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, · line 737

Quoted 8 lines
fsck/fsck.c +1 -1
@@ -731,7 +731,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
 	if (f2fs_has_extra_isize(&node_blk->i)) {
 		if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {
 			if (node_blk->i.i_extra_isize >
-				cpu_to_le16(F2FS_TOTAL_EXTRA_ATTR_SIZE)) {
+						4 * DEF_ADDRS_PER_INODE) {
 				FIX_MSG("ino[0x%x] recover i_extra_isize "
 					"from %u to %u",
 					nid,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
Quoted 5 lines · Chao Yu
Quoted 2 lines · Jaegeuk Kim

If we use later kernel having larger extra_isize, old fsck will delete entire old files.

Would it be better to construct the length based on existed features?

We can't judge the size for future fields.

Quoted 9 lines

Thanks,

Quoted 6 lines
---
 fsck/fsck.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
Quoted 6 lines
fsck/fsck.c +0 -0
index 1708abe..b4e53db 100644

fsck/fsck.c void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, · line 737

Quoted 8 lines
fsck/fsck.c +1 -1
@@ -731,7 +731,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid,
 	if (f2fs_has_extra_isize(&node_blk->i)) {
 		if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {
 			if (node_blk->i.i_extra_isize >
-				cpu_to_le16(F2FS_TOTAL_EXTRA_ATTR_SIZE)) {
+						4 * DEF_ADDRS_PER_INODE) {
 				FIX_MSG("ino[0x%x] recover i_extra_isize "
 					"from %u to %u",
 					nid,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reviewed-by
#3 lore raw
Quoted 8 lines · Jaegeuk Kim
Quoted 5 lines · Chao Yu
Quoted 2 lines · Jaegeuk Kim

If we use later kernel having larger extra_isize, old fsck will delete entire old files.

Would it be better to construct the length based on existed features?

We can't judge the size for future fields.

Alright, it's okay to just check it with the maximum value, though I think it needs to consider inline xattr space as well.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel