userfaultfd: replace ENOSPC with ESRCH in case mm has gone during copy/zeropage
PATCH 21/21 userfaultfd: replace ENOSPC with ESRCH in case mm has gone during copy/zeropage
From: Mike Rapoport <[email protected]>
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.
Signed-off-by Mike Rapoport <[email protected]>
Suggested-by Michal Hocko <[email protected]>
Acked-by Michal Hocko <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc "Dr. David Alan Gilbert" <[email protected]>
Cc Pavel Emelyanov <[email protected]>
Cc Mike Kravetz <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/userfaultfd.c renamed from fs/userfaultfd.c~userfaultfd-replace-enospc-with-esrch-in-case-mm-has-gone-during-copy-zeropage +2 -2
@@ -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 ;
_