• Alexei Naberezhnov's avatar
    md/raid5: fix 'out of memory' during raid cache recovery · 483cbbed
    Alexei Naberezhnov authored
    This fixes the case when md array assembly fails because of raid cache recovery
    unable to allocate a stripe, despite attempts to replay stripes and increase
    cache size. This happens because stripes released by r5c_recovery_replay_stripes
    and raid5_set_cache_size don't become available for allocation immediately.
    Released stripes first are placed on conf->released_stripes list and require
    md thread to merge them on conf->inactive_list before they can be allocated.
    
    Patch allows final allocation attempt during cache recovery to wait for
    new stripes to become availabe for allocation.
    
    Cc: linux-raid@vger.kernel.org
    Cc: Shaohua Li <shli@kernel.org>
    Cc: linux-stable <stable@vger.kernel.org> # 4.10+
    Fixes: b4c625c6 ("md/r5cache: r5cache recovery: part 1")
    Signed-off-by: default avatarAlexei Naberezhnov <anaberezhnov@fb.com>
    Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
    483cbbed
raid5-cache.c 87.9 KB