Re: [PATCH] mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs()

From: Mike Kravetz
Date: Fri Jan 03 2020 - 12:50:24 EST


On 1/3/20 9:37 AM, Jan Stancek wrote:
> LTP memfd_create04 started failing for some huge page sizes
> after v5.4-10135-gc3bfc5dd73c6.
>
> Problem is check introduced to for_each_hstate() loop that should
> skip default_hstate_idx. Since it doesn't update 'i' counter, all
> subsequent huge page sizes are skipped as well.
>
> Fixes: 8fc312b32b25 ("mm/hugetlbfs: fix error handling when setting up mounts")
> Signed-off-by: Jan Stancek <jstancek@xxxxxxxxxx>

Thank you Jan!

My apologies for a relatively obvious bug. Testing on x86 did not catch this
as the default hstate is set up last in the list. Not an excuse, but that is
why I missed it. :(

Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
--
Mike Kravetz