The patch titled Subject: userfaultfd: replace ENOSPC with ESRCH in case mm has gone during copy/zeropage has been added to the -mm tree. Its filename is userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage.patch 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/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Subject: userfaultfd: replace ENOSPC with ESRCH in case mm has gone during copy/zeropage When the process exit races with outstanding mcopy_atomic, it would be better to return ESRCH error. When such race occurs the process and it's mm are going away and returning "no such process" to the uffd monitor seems better fit than ENOSPC. Link: http://lkml.kernel.org/r/1502111545-32305-1-git-send-email-rppt@xxxxxxxxxxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Suggested-by: Michal Hocko <mhocko@xxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN fs/userfaultfd.c~userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage fs/userfaultfd.c --- a/fs/userfaultfd.c~userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage +++ a/fs/userfaultfd.c @@ -1600,7 +1600,7 @@ static int userfaultfd_copy(struct userf uffdio_copy.len); mmput(ctx->mm); } else { - return -ENOSPC; + return -ESRCH; } if (unlikely(put_user(ret, &user_uffdio_copy->copy))) return -EFAULT; @@ -1647,7 +1647,7 @@ static int userfaultfd_zeropage(struct u uffdio_zeropage.range.len); mmput(ctx->mm); } else { - return -ENOSPC; + return -ESRCH; } if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage))) return -EFAULT; _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxxxxxxx are userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage.patch shmem-shmem_charge-verify-max_block-is-not-exceeded-before-inode-update.patch shmem-introduce-shmem_inode_acct_block.patch userfaultfd-shmem-add-shmem_mfill_zeropage_pte-for-userfaultfd-support.patch userfaultfd-mcopy_atomic-introduce-mfill_atomic_pte-helper.patch userfaultfd-shmem-wire-up-shmem_mfill_zeropage_pte.patch userfaultfd-report-uffdio_zeropage-as-available-for-shmem-vmas.patch userfaultfd-selftest-enable-testing-of-uffdio_zeropage-for-shmem.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html