* [PATCH] mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs()
@ 2020-01-03 17:37 Jan Stancek
2020-01-03 17:50 ` Mike Kravetz
0 siblings, 1 reply; 2+ messages in thread
From: Jan Stancek @ 2020-01-03 17:37 UTC (permalink / raw)
To: mike.kravetz, akpm, linux-mm; +Cc: linux-kernel, jstancek
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@redhat.com>
---
fs/hugetlbfs/inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index d5c2a3158610..a66e425884d1 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1498,8 +1498,10 @@ static int __init init_hugetlbfs_fs(void)
/* other hstates are optional */
i = 0;
for_each_hstate(h) {
- if (i == default_hstate_idx)
+ if (i == default_hstate_idx) {
+ i++;
continue;
+ }
mnt = mount_one_hugetlbfs(h);
if (IS_ERR(mnt))
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs()
2020-01-03 17:37 [PATCH] mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs() Jan Stancek
@ 2020-01-03 17:50 ` Mike Kravetz
0 siblings, 0 replies; 2+ messages in thread
From: Mike Kravetz @ 2020-01-03 17:50 UTC (permalink / raw)
To: Jan Stancek, akpm, linux-mm; +Cc: linux-kernel
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@redhat.com>
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@oracle.com>
--
Mike Kravetz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-03 17:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 17:37 [PATCH] mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs() Jan Stancek
2020-01-03 17:50 ` Mike Kravetz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.