summaryrefslogtreecommitdiff
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-15 18:26:07 (GMT)
committer Minchan Kim <minchan@google.com>2019-03-28 06:49:16 (GMT)
commit572b9da3b98c7748063ae70806a596ae1afe6ba0 (patch)
tree0439963a48c1c6536e4157ca8006e772e5510780
parentf95937273d9205ec9a7fef0f4422374d1926bc05 (diff)
downloadcommon-572b9da3b98c7748063ae70806a596ae1afe6ba0.zip
common-572b9da3b98c7748063ae70806a596ae1afe6ba0.tar.gz
common-572b9da3b98c7748063ae70806a596ae1afe6ba0.tar.bz2
BACKPORT: filemap: add a comment about FAULT_FLAG_RETRY_NOWAIT behavior
I thought Josef Bacik's patch to drop the mmap_sem was buggy, because when looking at the error cases, there was one case where we returned VM_FAULT_RETRY without actually dropping the mmap_sem. Josef had to explain to me (using small words) that yes, that's actually what we're supposed to do, and his patch was correct. Which not only convinced me he knew what he was doing and I should stop arguing with him, but also that I should add a comment to the case I was confused about. Bug: 124328118 Patiently-pointed-out-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Minchan Kim <minchan@google.com> (cherry picked from commit 8b0f9fa2e02dc95216577c3387b0707c5f60fbaf) Change-Id: I2971fd1c817958748bcfb10938bd145467e7448e
Diffstat
-rw-r--r--mm/filemap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index cd30827..01a0d6a 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2164,6 +2164,11 @@ static int lock_page_maybe_drop_mmap(struct vm_area_struct *vma,
if (trylock_page(page))
return 1;
+ /*
+ * NOTE! This will make us return with VM_FAULT_RETRY, but with
+ * the mmap_sem still held. That's how FAULT_FLAG_RETRY_NOWAIT
+ * is supposed to work. We have way too many special cases..
+ */
if (flags & FAULT_FLAG_RETRY_NOWAIT)
return 0;
*fpin = maybe_unlock_mmap_for_io(vma, flags, *fpin);