userfaultfd: avoid missing wakeups during refile in userfaultfd_read
authorAndrea Arcangeli <aarcange@redhat.com>
Fri, 4 Sep 2015 22:47:23 +0000 (15:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Sep 2015 23:54:41 +0000 (16:54 -0700)
commit2c5b7e1be74ff0175dedbbd325abe9f0dbbb09ae
treee93f6aa423faeb6fbcd46103694d629b0a7bb82c
parent230c92a8797e0e717c6732de0fffdd5726c0f48f
userfaultfd: avoid missing wakeups during refile in userfaultfd_read

During the refile in userfaultfd_read both waitqueues could look empty to
the lockless wake_userfault().  Use a seqcount to prevent this false
negative that could leave an userfault blocked.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/userfaultfd.c