• ZhengYuan Liu's avatar
    raid5: fix incorrectly counter of conf->empty_inactive_list_nr · ff00d3b4
    ZhengYuan Liu authored
    
    
    The counter conf->empty_inactive_list_nr is only used for determine if the
    raid5 is congested which is deal with in function raid5_congested().
    It was increased in get_free_stripe() when conf->inactive_list got to be
    empty and decreased in release_inactive_stripe_list() when splice
    temp_inactive_list to conf->inactive_list. However, this may have a
    problem when raid5_get_active_stripe or stripe_add_to_batch_list was called,
    because these two functions may call list_del_init(&sh->lru) to delete sh from
    "conf->inactive_list + hash" which may cause "conf->inactive_list + hash" to
    be empty when atomic_inc_not_zero(&sh->count) got false. So a check should be
    done at these two point and increase empty_inactive_list_nr accordingly.
    Otherwise the counter may get to be negative number which would influence
    async readahead from VFS.
    Signed-off-by: default avatarZhengYuan Liu <liuzhengyuan@kylinos.cn>
    Signed-off-by: default avatarShaohua Li <shli@fb.com>
    ff00d3b4
raid5.c 224 KB