• Andrew Morton's avatar
    [PATCH] ext2 block allocator fixes · a9bca018
    Andrew Morton authored
    Fix a couple of problems which were introduced by a recent race fix in the
    ext2 block allocator:
    
    - if the allocation attempt raced, and lost the race then a new attempt is
      made.  But the earlier reservation must be put back first.
    
      Add a call to group_release_blocks() to fix this.
    
    - if the filesystem is genuinely corrupted then the code as-is can get
      stuck in an infinite loop, thinking that a blockgroup has free blocks and
      then discovering that its bitmap is full.
    
      Fix this by baling out after having scanned all blockgroups twice.
    
      (Thanks Muli Ben-Yehuda <mulix@mulix.org> for spotting this).
    a9bca018
balloc.c 19.2 KB