The patch titled Subject: mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-fix has been added to the -mm mm-unstable branch. Its filename is mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-fix Date: Fri Jul 5 03:12:47 PM PDT 2024 propagate try_grab_folio() retval, including the weird -EREMOTEIO Cc: SeongJae Park <sj@xxxxxxxxxx> Cc: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/mm/gup.c~mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-fix +++ a/mm/gup.c @@ -3848,6 +3848,8 @@ long memfd_pin_folios(struct file *memfd next_idx = 0; for (i = 0; i < nr_found; i++) { + int ret2; + /* * As there can be multiple entries for a * given folio in the batch returned by @@ -3860,10 +3862,10 @@ long memfd_pin_folios(struct file *memfd continue; folio = page_folio(&fbatch.folios[i]->page); - - if (try_grab_folio(folio, 1, FOLL_PIN)) { + ret2 = try_grab_folio(folio, 1, FOLL_PIN); + if (ret2) { folio_batch_release(&fbatch); - ret = -EINVAL; + ret = ret2; goto err; } _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix.patch mm-gup-introduce-memfd_pin_folios-for-pinning-memfd-folios-fix-fix.patch mm-store-zero-pages-to-be-swapped-out-in-a-bitmap-v7-fix.patch tools-mm-introduce-a-tool-to-assess-swap-entry-allocation-for-thp_swapout-fix.patch