userfaultfd: convert to ->read_iter()
authorJens Axboe <axboe@kernel.dk>
Tue, 2 Apr 2024 18:26:41 +0000 (12:26 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Apr 2024 22:23:04 +0000 (16:23 -0600)
commit40f45fe8eb7efd70e772447dc98bb50c5e323ccb
tree4377510086182ebff4e8bb2867d90134959968b4
parentd94979904105a7ad8dca6fdcd8cb3fbecada22f1
userfaultfd: convert to ->read_iter()

Rather than use the older style ->read() hook, use ->read_iter() so that
userfaultfd can support both O_NONBLOCK and IOCB_NOWAIT for non-blocking
read attempts.

Split the fd setup into two parts, so that userfaultfd can mark the file
mode with FMODE_NOWAIT before installing it into the process table. With
that, we can also defer grabbing the mm until we know the rest will
succeed, as the fd isn't visible before then.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/userfaultfd.c