• Andrew Morton's avatar
    [PATCH] ext2/ext3 -ENOSPC bug · 5e9087ad
    Andrew Morton authored
    From: Chris Mason <mason@suse.com>
    
    find_group_other looks buggy for ext2 and ext3 in 2.6, it can cause -ENOSPC
    errors when the fs has plenty of free room.
    
    To hit the bug, you need a filesystem where:
    
    parent_group has no free blocks (but might have free inodes) Every other
    group with free inodes has no free blocks.
    
    That gets you down to the final linear search in find_group_other.  The
    linear search has two bugs:
    
    group = parent_group + 1; means we start searching at parent_group + 2
    because the loop increments group before using it.
    
    for(i = 2 ; i < ngroups ; i++) means we don't search through all the
    groups.
    
    The end result is that parent_group and parent_group + 1 are not checked
    for free inodes in the final linear search.  ext3 has the same problem.
    5e9087ad
ialloc.c 20.2 KB