6bd4127 gfs2_convert: calculate height 1 for small files that were once big

Authored and Committed by rpeterso 11 years ago
    gfs2_convert: calculate height 1 for small files that were once big
    
    This patch changes function calc_gfs2_tree_height so that it gives
    a height of 1 to small files that once were big. The problems here
    is with files that were once big (needed two levels of indirection
    (height 2)) and then are truncated to a tiny non-zero size
    (ordinarily, they would be stuffed, but due to the growth followed
    by truncate, they're still at height 2). The required GFS2 height is
    zero, whereas the GFS1 height is 2. After the conversion the file
    will not really be stuffed, because function fix_metatree will
    unstuff the dinode as part of its conversion. So at least it will
    be at height 1. The problem is that if we don't fix the 0 height to
    its proper value of 1, fix_ind_reg_or_dir gets called with gfs2_hgt=0,
    which then calls mp_gfs1_to_gfs2, which then tries to set:
    gfs2factor[gfs2_h - 1] = 1ull. This results in a negative index of the
    array.
    
    rhbz#887374
    
        
file modified
+6 -0