• T
    idr: fix obscure bug in allocation path · 7aae6dd8
    Tejun Heo 提交于
    In sub_alloc(), when bitmap search fails, it goes up one level to
    continue search.  This is done by updating the id cursor and searching
    the upper level again.  If the cursor was at the end of the upper
    level, we need to go further than that.
    
    This wasn't implemented and when that happens the part of the cursor
    which indexes into the upper level wraps and sub_alloc() ends up
    searching the wrong bitmap.  It allocates id which doesn't match the
    actual slot.
    
    This patch fixes this by restarting from the top if the search needs
    to go higher than one level.
    Signed-off-by: NTejun Heo <htejun@gmail.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
    
    7aae6dd8
idr.c 11.1 KB