2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 18:07:57 +00:00

kerndat: handle the case when hugetlb isn't supported

Currently we check memfd_hugetlb by doing memfd_create("", MFD_HUGETLB).
If we see EINVAL we report that it's not supported, but we can also
get ENOENT error in such case in hugetlb_file_setup() while trying
to find proper hugetlbfs mount.

Reference:
https://github.com/torvalds/linux/blob/06fb4ecfeac/fs/hugetlbfs/inode.c#L1465

Fixes: 4245e6b02fa ("check: Add a check for using memfd with hugetlb")

Reported-by: Mr. Jenkins (ppc64le)
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
This commit is contained in:
Alexander Mikhalitsyn 2022-05-05 12:41:48 +00:00 committed by Andrei Vagin
parent 17a19676cd
commit 0c1f0256ff

View File

@ -502,7 +502,7 @@ static bool kerndat_has_memfd_hugetlb(void)
if (ret >= 0) { if (ret >= 0) {
kdat.has_memfd_hugetlb = true; kdat.has_memfd_hugetlb = true;
close(ret); close(ret);
} else if (ret == -1 && errno == EINVAL) { } else if (ret == -1 && (errno == EINVAL || errno == ENOENT)) {
kdat.has_memfd_hugetlb = false; kdat.has_memfd_hugetlb = false;
} else { } else {
pr_perror("Unexpected error from memfd_create(\"\", MFD_HUGETLB)"); pr_perror("Unexpected error from memfd_create(\"\", MFD_HUGETLB)");