Skip to contentSkip to conversation

ext4: fix incorrect type issue during replay_del_range

PATCH Applied Xin Yin 3 participants 3 messages Jan 26, 2022 – Jan 29, 2022 ext4 file system

lore
Share & tools
lore

Xin Yin

author
#0 lore raw

PATCH 1/1 ext4: fix incorrect type issue during replay_del_range

should not use fast commit log data directly, add le32_to_cpu().

Fixes 0b5b5a62b945 ("ext4: use ext4_ext_remove_space() for fast commit replay delete range")
---
 fs/ext4/fast_commit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/fast_commit.c +3 -2
index ccd2b216d6ba..488347b4c8b0 100644
@@ -1798,8 +1798,9 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
 	}
 
 	down_write(&EXT4_I(inode)->i_data_sem);
-	ret = ext4_ext_remove_space(inode, lrange.fc_lblk,
-				lrange.fc_lblk + lrange.fc_len - 1);
+	ret = ext4_ext_remove_space(inode, le32_to_cpu(lrange.fc_lblk),
+				le32_to_cpu(lrange.fc_lblk) +
+				le32_to_cpu(lrange.fc_len) - 1);
 	up_write(&EXT4_I(inode)->i_data_sem);
 	if (ret) {
 		iput(inode);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Xin Yin

should not use fast commit log data directly, add le32_to_cpu().

Fixes 0b5b5a62b945 ("ext4: use ext4_ext_remove_space() for fast commit replay delete range")

Yes, a required change indeed.
Since the patch marked as fixes was cc'd to stable, so this might be requird as well.

Quoted 23 lines
---
 fs/ext4/fast_commit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/fast_commit.c +3 -3
index ccd2b216d6ba..488347b4c8b0 100644
@@ -1798,8 +1798,9 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
 	}
 
 	down_write(&EXT4_I(inode)->i_data_sem);
-	ret = ext4_ext_remove_space(inode, lrange.fc_lblk,
-				lrange.fc_lblk + lrange.fc_len - 1);
+	ret = ext4_ext_remove_space(inode, le32_to_cpu(lrange.fc_lblk),
+				le32_to_cpu(lrange.fc_lblk) +
+				le32_to_cpu(lrange.fc_len) - 1);
 	up_write(&EXT4_I(inode)->i_data_sem);
 	if (ret) {
 		iput(inode);
--

2.25.1

maintainer Applied
#2 lore raw
In reply to Xin Yin
Quoted 3 lines · Xin Yin

should not use fast commit log data directly, add le32_to_cpu().

Applied, thanks!

[1/1] ext4: fix incorrect type issue during replay_del_range

      commit: 3f6a7abe77c1cbe125e2f743568c810470d66e7d

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>