提交 68998a98 编写于 作者: L Luo Meng 提交者: Yang Yingliang

ext4: only set last error block when check system zone failed

hulk inclusion
category: bugfix
bugzilla: 39268
CVE: NA

-------------------------------------------------

Since the code of commit c03b42efb1c4 ("ext4: Fold ext4_data_block_valid_rcu()
into the caller") when check valid the inode blocks, we set the last error
block before final determination the block is invalid, which confuses with
linux master.

The block should be invalid only when the block is belong to the system zone.
The system zone was initialized when mount, and the entry->ino just should be
0 or journal_ino, and it never changed in his lifetime. Only when check the
inode with ino=0/journal_ino will cause set the wrong last error block.
But the ino=0/journal_ino never call ext4_inode_block_valid, so it never case
any problem.

In order to keep the same logic with linux master and dispel the confuse,
add explicit judgment for invalid block before set the last error block.

Fixes: c03b42efb1c4 ("ext4: Fold ext4_data_block_valid_rcu() into the caller")
Signed-off-by: NLuo Meng <luomeng12@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b3d1e9e1
...@@ -326,8 +326,9 @@ int ext4_inode_block_valid(struct inode *inode, ext4_fsblk_t start_blk, ...@@ -326,8 +326,9 @@ int ext4_inode_block_valid(struct inode *inode, ext4_fsblk_t start_blk,
else if (start_blk >= (entry->start_blk + entry->count)) else if (start_blk >= (entry->start_blk + entry->count))
n = n->rb_right; n = n->rb_right;
else { else {
sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
ret = (entry->ino == inode->i_ino); ret = (entry->ino == inode->i_ino);
if (!ret)
sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
break; break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册