Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95034
b: refs/heads/master
c: 161e7b7
h: refs/heads/master
v: v3
  • Loading branch information
Aneesh Kumar K.V authored and Theodore Ts'o committed Apr 30, 2008
1 parent e1dd040 commit f8dcff5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1a89734d4057066344356e9c7e13b6379497aebe
refs/heads/master: 161e7b7c1d24112d188df9a7b30d468a8d135b96
48 changes: 43 additions & 5 deletions trunk/fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
ex->ee_len = orig_ex.ee_len;
ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
ext4_ext_dirty(handle, inode, path + depth);
return le16_to_cpu(ex->ee_len);
/* zeroed the full extent */
return allocated;
}

/* ex1: ee_block to iblock - 1 : uninitialized */
Expand Down Expand Up @@ -2311,11 +2312,45 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
ex->ee_len = orig_ex.ee_len;
ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
ext4_ext_dirty(handle, inode, path + depth);
return le16_to_cpu(ex->ee_len);
/* zeroed the full extent */
return allocated;

} else if (err)
goto fix_extent_len;

/*
* We need to zero out the second half because
* an fallocate request can update file size and
* converting the second half to initialized extent
* implies that we can leak some junk data to user
* space.
*/
err = ext4_ext_zeroout(inode, ex3);
if (err) {
/*
* We should actually mark the
* second half as uninit and return error
* Insert would have changed the extent
*/
depth = ext_depth(inode);
ext4_ext_drop_refs(path);
path = ext4_ext_find_extent(inode,
iblock, path);
if (IS_ERR(path)) {
err = PTR_ERR(path);
return err;
}
ex = path[depth].p_ext;
err = ext4_ext_get_access(handle, inode,
path + depth);
if (err)
return err;
ext4_ext_mark_uninitialized(ex);
ext4_ext_dirty(handle, inode, path + depth);
return err;
}

/* zeroed the second half */
return allocated;
}
ex3 = &newex;
Expand All @@ -2333,7 +2368,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
ex->ee_len = orig_ex.ee_len;
ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
ext4_ext_dirty(handle, inode, path + depth);
return le16_to_cpu(ex->ee_len);
/* zeroed the full extent */
return allocated;

} else if (err)
goto fix_extent_len;
Expand Down Expand Up @@ -2381,7 +2417,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
ex->ee_len = orig_ex.ee_len;
ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
ext4_ext_dirty(handle, inode, path + depth);
return le16_to_cpu(ex->ee_len);
/* zero out the first half */
return allocated;
}
}
/*
Expand Down Expand Up @@ -2448,7 +2485,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
ex->ee_len = orig_ex.ee_len;
ext4_ext_store_pblock(ex, ext_pblock(&orig_ex));
ext4_ext_dirty(handle, inode, path + depth);
return le16_to_cpu(ex->ee_len);
/* zero out the first half */
return allocated;
} else if (err)
goto fix_extent_len;
out:
Expand Down

0 comments on commit f8dcff5

Please sign in to comment.