Add patches to fix kernel crashes on corrupted file systems
[ext4-patch-queue.git] / drop-EXT4_EX_NOFREE_ON_ERR-in-convert_initialized_extent
blobe86dcec7450ed88de08010f9061ea5404736c79a
1 ext4: drop EXT4_EX_NOFREE_ON_ERR in convert_initialized_extent()
3 Transfer responsibility of freeing struct ext4_ext_path on error to
4 ext4_ext_find_extent().
6 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 ---
8  fs/ext4/extents.c | 10 +++++-----
9  1 file changed, 5 insertions(+), 5 deletions(-)
11 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
12 index 985848d..ceab095 100644
13 --- a/fs/ext4/extents.c
14 +++ b/fs/ext4/extents.c
15 @@ -3921,9 +3921,10 @@ get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start,
16  static int
17  convert_initialized_extent(handle_t *handle, struct inode *inode,
18                            struct ext4_map_blocks *map,
19 -                          struct ext4_ext_path *path, int flags,
20 +                          struct ext4_ext_path **ppath, int flags,
21                            unsigned int allocated, ext4_fsblk_t newblock)
22  {
23 +       struct ext4_ext_path *path = *ppath;
24         struct ext4_extent *ex;
25         ext4_lblk_t ee_block;
26         unsigned int ee_len;
27 @@ -3952,8 +3953,7 @@ convert_initialized_extent(handle_t *handle, struct inode *inode,
28                 if (err < 0)
29                         return err;
30                 ext4_ext_drop_refs(path);
31 -               path = ext4_ext_find_extent(inode, map->m_lblk, &path,
32 -                                           EXT4_EX_NOFREE_ON_ERR);
33 +               path = ext4_ext_find_extent(inode, map->m_lblk, ppath, 0);
34                 if (IS_ERR(path))
35                         return PTR_ERR(path);
36                 depth = ext_depth(inode);
37 @@ -4331,8 +4331,8 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
38                         if ((!ext4_ext_is_unwritten(ex)) &&
39                             (flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) {
40                                 allocated = convert_initialized_extent(
41 -                                               handle, inode, map, path, flags,
42 -                                               allocated, newblock);
43 +                                               handle, inode, map, &path,
44 +                                               flags, allocated, newblock);
45                                 goto out2;
46                         } else if (!ext4_ext_is_unwritten(ex))
47                                 goto out;