Whamcloud - gitweb
LU-7980 ldiskfs: always pre-allocate max depth for path 49/19349/7
authorBruno Faccini <bruno.faccini@intel.com>
Wed, 6 Apr 2016 14:38:05 +0000 (16:38 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 28 Apr 2016 04:23:24 +0000 (04:23 +0000)
commit655255b651d80d115fbde6729bd58e22afce6483
tree3a4d5976d6d5d997adfb1645d7f9907983e7b335
parent3e95945ff970426a5904c859feed46176e678305
LU-7980 ldiskfs: always pre-allocate max depth for path

Upon very specific meta-data and I/O pattern a situation can be
encountered where ext_depth() will concurrently (due to i_data_sem
release) grow outside of currently used ext4_ext_path[] array
boundary.
This can lead to potential Slab overrun if current ext_depth()
is used to index previously sized+allocated ext4_ext_path[] array.
This patch fixes this by already pre-allocating _ext_path[]
array of the max possible depth.

This is an alternate way to avoid racy cases, that can lead to
slab overrun, with current and unsafe implementation that causes
ext4_ext_path[] array re-[sizing,allocation] based on current depth.

Now unnecessay free an realloc upon depth change detection prior to
reuse already allocated path space have also been removed.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I0ae955c5eccf032cb02ef55c6381964a5eaf82c2
Reviewed-on: http://review.whamcloud.com/19349
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
ldiskfs/kernel_patches/patches/rhel6.6/ext4_s_max_ext_tree_depth.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel7/ext4_s_max_ext_tree_depth.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/sles11sp3/ext4_s_max_ext_tree_depth.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.6.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.7.series
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11.series
ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.series