Skip to contentSkip to conversation

f2fs: don't call block truncation for aliased file

PATCH In review Jaegeuk Kim 3 participants 5 messages Jan 7, 2025 – Jan 8, 2025 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: don't call block truncation for aliased file

This patch should avoid the below warning which does not corrupt the metadata tho.

[   51.508120][  T253] F2FS-fs (dm-59): access invalid blkaddr:36
[   51.508156][  T253]  __f2fs_is_valid_blkaddr+0x330/0x384
[   51.508162][  T253]  f2fs_is_valid_blkaddr_raw+0x10/0x24
[   51.508163][  T253]  f2fs_truncate_data_blocks_range+0x1ec/0x438
[   51.508177][  T253]  f2fs_remove_inode_page+0x8c/0x148
[   51.508194][  T253]  f2fs_evict_inode+0x230/0x76c
Fixes 128d333f0dff ("f2fs: introduce device aliasing file")
---
 fs/f2fs/node.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/f2fs/node.c +6 -0
index c04ee1a7ce57..06313e1eb884 100644
@@ -1274,6 +1274,12 @@ int f2fs_remove_inode_page(struct inode *inode)
 		return err;
 	}
 
+	/* The aliase file must be truncated successfully. */
+	if (unlikely(IS_DEVICE_ALIASING(inode))) {
+		f2fs_put_dnode(&dn);
+		return 0;
+	}
+
 	/* remove potential inline_data blocks */
 	if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
 				S_ISLNK(inode->i_mode))
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
maintainer
#1 lore raw
Quoted 21 lines · On 2025/1/7 10:32, Jaegeuk Kim via Linux-f2fs-devel wrote:

This patch should avoid the below warning which does not corrupt the metadata tho.

[   51.508120][  T253] F2FS-fs (dm-59): access invalid blkaddr:36
[   51.508156][  T253]  __f2fs_is_valid_blkaddr+0x330/0x384
[   51.508162][  T253]  f2fs_is_valid_blkaddr_raw+0x10/0x24
[   51.508163][  T253]  f2fs_truncate_data_blocks_range+0x1ec/0x438
[   51.508177][  T253]  f2fs_remove_inode_page+0x8c/0x148
[   51.508194][  T253]  f2fs_evict_inode+0x230/0x76c
Fixes 128d333f0dff ("f2fs: introduce device aliasing file")
---
  fs/f2fs/node.c | 6 ++++++
  1 file changed, 6 insertions(+)
fs/f2fs/node.c +0 -0
index c04ee1a7ce57..06313e1eb884 100644

fs/f2fs/node.c int f2fs_remove_inode_page(struct inode *inode) · line 1280

Quoted 7 lines
fs/f2fs/node.c +4 -0
@@ -1274,6 +1274,12 @@ int f2fs_remove_inode_page(struct inode *inode)
  		return err;
  	}
 
+	/* The aliase file must be truncated successfully. */
+	if (unlikely(IS_DEVICE_ALIASING(inode))) {
+		f2fs_put_dnode(&dn);
+		return 0;

Do we need to keep calling truncate_node() for device alias inode in f2fs_remove_inode_page()?

Thanks,

Quoted 5 lines
fs/f2fs/node.c +2 -0
+	}
+
  	/* remove potential inline_data blocks */
  	if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
  				S_ISLNK(inode->i_mode))
#2 lore raw
Quoted 34 lines · On Tue, Jan 7, 2025 at 7:00 AM Chao Yu via Linux-f2fs-devel…
Quoted 21 lines · On 2025/1/7 10:32, Jaegeuk Kim via Linux-f2fs-devel wrote:

This patch should avoid the below warning which does not corrupt the metadata tho.

[   51.508120][  T253] F2FS-fs (dm-59): access invalid blkaddr:36
[   51.508156][  T253]  __f2fs_is_valid_blkaddr+0x330/0x384
[   51.508162][  T253]  f2fs_is_valid_blkaddr_raw+0x10/0x24
[   51.508163][  T253]  f2fs_truncate_data_blocks_range+0x1ec/0x438
[   51.508177][  T253]  f2fs_remove_inode_page+0x8c/0x148
[   51.508194][  T253]  f2fs_evict_inode+0x230/0x76c
Fixes 128d333f0dff ("f2fs: introduce device aliasing file")
---
  fs/f2fs/node.c | 6 ++++++
  1 file changed, 6 insertions(+)
fs/f2fs/node.c +0 -0
index c04ee1a7ce57..06313e1eb884 100644

fs/f2fs/node.c int f2fs_remove_inode_page(struct inode *inode) · line 1280

Quoted 7 lines
fs/f2fs/node.c +4 -0
@@ -1274,6 +1274,12 @@ int f2fs_remove_inode_page(struct inode *inode)
              return err;
      }
 
+     /* The aliase file must be truncated successfully. */
+     if (unlikely(IS_DEVICE_ALIASING(inode))) {
+             f2fs_put_dnode(&dn);
+             return 0;

Do we need to keep calling truncate_node() for device alias inode in f2fs_remove_inode_page()?

Quoted 8 lines

Thanks,

Quoted 5 lines
fs/f2fs/node.c +2 -0
+     }
+
      /* remove potential inline_data blocks */
      if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
                              S_ISLNK(inode->i_mode))

How about modifying like the below?

        /* remove potential inline_data blocks */
        if (!IS_DEVICE_ALIASING(inode) &&
            (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
                                S_ISLNK(inode->i_mode)))

Thanks,

Quoted 5 lines

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

author maintainer
#3 lore raw
In reply to Jaegeuk Kim

This patch should avoid the below warning which does not corrupt the metadata tho.

[   51.508120][  T253] F2FS-fs (dm-59): access invalid blkaddr:36
[   51.508156][  T253]  __f2fs_is_valid_blkaddr+0x330/0x384
[   51.508162][  T253]  f2fs_is_valid_blkaddr_raw+0x10/0x24
[   51.508163][  T253]  f2fs_truncate_data_blocks_range+0x1ec/0x438
[   51.508177][  T253]  f2fs_remove_inode_page+0x8c/0x148
[   51.508194][  T253]  f2fs_evict_inode+0x230/0x76c
Fixes 128d333f0dff ("f2fs: introduce device aliasing file")
---
 fs/f2fs/node.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/node.c +3 -2
index c04ee1a7ce57..00f340c91fcb 100644
@@ -1275,8 +1275,9 @@ int f2fs_remove_inode_page(struct inode *inode)
 	}
 
 	/* remove potential inline_data blocks */
-	if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
-				S_ISLNK(inode->i_mode))
+	if (!IS_DEVICE_ALIASING(inode) &&
+	    (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
+	     S_ISLNK(inode->i_mode)))
 		f2fs_truncate_data_blocks_range(&dn, 1);
 
 	/* 0 is possible, after f2fs_new_inode() has failed */
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
maintainer Reviewed-by
#4 lore raw
Quoted 10 lines · On 2025/1/8 03:09, Jaegeuk Kim via Linux-f2fs-devel wrote:

This patch should avoid the below warning which does not corrupt the metadata tho.

[   51.508120][  T253] F2FS-fs (dm-59): access invalid blkaddr:36
[   51.508156][  T253]  __f2fs_is_valid_blkaddr+0x330/0x384
[   51.508162][  T253]  f2fs_is_valid_blkaddr_raw+0x10/0x24
[   51.508163][  T253]  f2fs_truncate_data_blocks_range+0x1ec/0x438
[   51.508177][  T253]  f2fs_remove_inode_page+0x8c/0x148
[   51.508194][  T253]  f2fs_evict_inode+0x230/0x76c
Quoted 2 lines
Fixes 128d333f0dff ("f2fs: introduce device aliasing file")

Thanks,