Commit 08259d58 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

mm: add comment on swap_duplicate's error code

swap_duplicate()'s loop appears to miss out on returning the error code
from __swap_duplicate(), except when that's -ENOMEM.  In fact this is
intentional: prior to -ENOMEM for swap_count_continuation,
swap_duplicate() was void (and the case only occurs when copy_one_pte()
hits a corrupt pte).  But that's surprising behaviour, which certainly
deserves a comment.
Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Reported-by: default avatarHuang Shijie <shijie8@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c08c6e1f
...@@ -2161,7 +2161,11 @@ void swap_shmem_alloc(swp_entry_t entry) ...@@ -2161,7 +2161,11 @@ void swap_shmem_alloc(swp_entry_t entry)
} }
/* /*
* increase reference count of swap entry by 1. * Increase reference count of swap entry by 1.
* Returns 0 for success, or -ENOMEM if a swap_count_continuation is required
* but could not be atomically allocated. Returns 0, just as if it succeeded,
* if __swap_duplicate() fails for another reason (-EINVAL or -ENOENT), which
* might occur if a page table entry has got corrupted.
*/ */
int swap_duplicate(swp_entry_t entry) int swap_duplicate(swp_entry_t entry)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment