Revert "ext4: drop ppath from ext4_ext_replay_update_ex() to avoid double-free"
This reverts commit a92dad3741
.
This commit is contained in:
parent
93a6c5ff53
commit
c8162dd5e3
1 changed files with 11 additions and 10 deletions
|
@ -5928,7 +5928,7 @@ out:
|
|||
int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start,
|
||||
int len, int unwritten, ext4_fsblk_t pblk)
|
||||
{
|
||||
struct ext4_ext_path *path;
|
||||
struct ext4_ext_path *path = NULL, *ppath;
|
||||
struct ext4_extent *ex;
|
||||
int ret;
|
||||
|
||||
|
@ -5944,29 +5944,30 @@ int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start,
|
|||
if (le32_to_cpu(ex->ee_block) != start ||
|
||||
ext4_ext_get_actual_len(ex) != len) {
|
||||
/* We need to split this extent to match our extent first */
|
||||
ppath = path;
|
||||
down_write(&EXT4_I(inode)->i_data_sem);
|
||||
ret = ext4_force_split_extent_at(NULL, inode, &path, start, 1);
|
||||
ret = ext4_force_split_extent_at(NULL, inode, &ppath, start, 1);
|
||||
up_write(&EXT4_I(inode)->i_data_sem);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
path = ext4_find_extent(inode, start, &path, 0);
|
||||
kfree(path);
|
||||
path = ext4_find_extent(inode, start, NULL, 0);
|
||||
if (IS_ERR(path))
|
||||
return PTR_ERR(path);
|
||||
return -1;
|
||||
ppath = path;
|
||||
ex = path[path->p_depth].p_ext;
|
||||
WARN_ON(le32_to_cpu(ex->ee_block) != start);
|
||||
|
||||
if (ext4_ext_get_actual_len(ex) != len) {
|
||||
down_write(&EXT4_I(inode)->i_data_sem);
|
||||
ret = ext4_force_split_extent_at(NULL, inode, &path,
|
||||
ret = ext4_force_split_extent_at(NULL, inode, &ppath,
|
||||
start + len, 1);
|
||||
up_write(&EXT4_I(inode)->i_data_sem);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
path = ext4_find_extent(inode, start, &path, 0);
|
||||
kfree(path);
|
||||
path = ext4_find_extent(inode, start, NULL, 0);
|
||||
if (IS_ERR(path))
|
||||
return PTR_ERR(path);
|
||||
return -EINVAL;
|
||||
ex = path[path->p_depth].p_ext;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue