summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'work.aio-1' of ↵Linus Torvalds2018-06-0499-595/+849
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull aio updates from Al Viro: "Majority of AIO stuff this cycle. aio-fsync and aio-poll, mostly. The only thing I'm holding back for a day or so is Adam's aio ioprio - his last-minute fixup is trivial (missing stub in !CONFIG_BLOCK case), but let it sit in -next for decency sake..." * 'work.aio-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits) aio: sanitize the limit checking in io_submit(2) aio: fold do_io_submit() into callers aio: shift copyin of iocb into io_submit_one() aio_read_events_ring(): make a bit more readable aio: all callers of aio_{read,write,fsync,poll} treat 0 and -EIOCBQUEUED the same way aio: take list removal to (some) callers of aio_complete() aio: add missing break for the IOCB_CMD_FDSYNC case random: convert to ->poll_mask timerfd: convert to ->poll_mask eventfd: switch to ->poll_mask pipe: convert to ->poll_mask crypto: af_alg: convert to ->poll_mask net/rxrpc: convert to ->poll_mask net/iucv: convert to ->poll_mask net/phonet: convert to ->poll_mask net/nfc: convert to ->poll_mask net/caif: convert to ->poll_mask net/bluetooth: convert to ->poll_mask net/sctp: convert to ->poll_mask net/tipc: convert to ->poll_mask ...
| * aio: sanitize the limit checking in io_submit(2)Al Viro2018-05-291-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as it is, the logics in native io_submit(2) is "if asked for more than LONG_MAX/sizeof(pointer) iocbs to submit, don't bother with more than LONG_MAX/sizeof(pointer)" (i.e. 512M requests on 32bit and 1E requests on 64bit) while compat io_submit(2) goes with "stop after the first PAGE_SIZE/sizeof(pointer) iocbs", i.e. 1K or so. Which is * inconsistent * *way* too much in native case * possibly too little in compat one and * wrong anyway, since the natural point where we ought to stop bothering is ctx->nr_events Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * aio: fold do_io_submit() into callersAl Viro2018-05-291-54/+45
| | | | | | | | | | | | | | | | get rid of insane "copy array of 32bit pointers into an array of native ones" glue. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * aio: shift copyin of iocb into io_submit_one()Al Viro2018-05-291-24/+22
| | | | | | | | | | Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * aio_read_events_ring(): make a bit more readableAl Viro2018-05-291-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | The logics for 'avail' is * not past the tail of cyclic buffer * no more than asked * not past the end of buffer * not past the end of a page Unobfuscate the last part. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * aio: all callers of aio_{read,write,fsync,poll} treat 0 and -EIOCBQUEUED the ↵Al Viro2018-05-291-14/+12
| | | | | | | | | | | | | | | | | | same way ... so just make them return 0 when caller does not need to destroy iocb Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * aio: take list removal to (some) callers of aio_complete()Al Viro2018-05-291-17/+21
| | | | | | | | | | | | | | We really want iocb out of io_cancel(2) reach before we start tearing it down. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * aio: add missing break for the IOCB_CMD_FDSYNC caseChristoph Hellwig2018-05-281-0/+1
| | | | | | | | | | | | | | Looks like this got lost in a merge. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * random: convert to ->poll_maskChristoph Hellwig2018-05-261-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | The big change is that random_read_wait and random_write_wait are merged into a single waitqueue that uses keyed wakeups. Because wait_event_* doesn't know about that this will lead to occassional spurious wakeups in _random_read and add_hwgenerator_randomness, but wait_event_* is designed to handle these and were are not in a a hot path there. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * timerfd: convert to ->poll_maskChristoph Hellwig2018-05-261-11/+11
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * eventfd: switch to ->poll_maskChristoph Hellwig2018-05-261-4/+11
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * pipe: convert to ->poll_maskChristoph Hellwig2018-05-261-9/+13
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * crypto: af_alg: convert to ->poll_maskChristoph Hellwig2018-05-264-16/+8
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/rxrpc: convert to ->poll_maskChristoph Hellwig2018-05-261-7/+3
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/iucv: convert to ->poll_maskChristoph Hellwig2018-05-262-7/+2
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/phonet: convert to ->poll_maskChristoph Hellwig2018-05-261-5/+2
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/nfc: convert to ->poll_maskChristoph Hellwig2018-05-261-6/+3
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/caif: convert to ->poll_maskChristoph Hellwig2018-05-261-8/+4
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/bluetooth: convert to ->poll_maskChristoph Hellwig2018-05-265-9/+6
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/sctp: convert to ->poll_maskChristoph Hellwig2018-05-264-7/+4
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/tipc: convert to ->poll_maskChristoph Hellwig2018-05-261-9/+5
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/vmw_vsock: convert to ->poll_maskChristoph Hellwig2018-05-261-13/+6
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/atm: convert to ->poll_maskChristoph Hellwig2018-05-264-11/+6
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/dccp: convert to ->poll_maskChristoph Hellwig2018-05-264-15/+5
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net: convert datagram_poll users tp ->poll_maskChristoph Hellwig2018-05-2631-59/+52
| | | | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * net/unix: convert to ->poll_maskChristoph Hellwig2018-05-261-19/+11
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net/tcp: convert to ->poll_maskChristoph Hellwig2018-05-264-21/+9
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net: remove sock_no_pollChristoph Hellwig2018-05-2610-17/+0
| | | | | | | | | | | | | | Now that sock_poll handles a NULL ->poll or ->poll_mask there is no need for a stub. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net: add support for ->poll_mask in proto_opsChristoph Hellwig2018-05-262-5/+44
| | | | | | | | | | | | | | The socket file operations still implement ->poll until all protocols are switched over. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * net: refactor socket_pollChristoph Hellwig2018-05-262-17/+19
| | | | | | | | | | | | | | | | Factor out two busy poll related helpers for late reuse, and remove a command that isn't very helpful, especially with the __poll_t annotations in place. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * aio: try to complete poll iocbs without context switchChristoph Hellwig2018-05-261-3/+17
| | | | | | | | | | | | | | | | If we can acquire ctx_lock without spinning we can just remove our iocb from the active_reqs list, and thus complete the iocbs from the wakeup context. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * aio: implement IOCB_CMD_POLLChristoph Hellwig2018-05-262-5/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Simple one-shot poll through the io_submit() interface. To poll for a file descriptor the application should submit an iocb of type IOCB_CMD_POLL. It will poll the fd for the events specified in the the first 32 bits of the aio_buf field of the iocb. Unlike poll or epoll without EPOLLONESHOT this interface always works in one shot mode, that is once the iocb is completed, it will have to be resubmitted. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * aio: simplify cancellationChristoph Hellwig2018-05-261-42/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | With the current aio code there is no need for the magic KIOCB_CANCELLED value, as a cancelation just kicks the driver to queue the completion ASAP, with all actual completion handling done in another thread. Given that both the completion path and cancelation take the context lock there is no need for magic cmpxchg loops either. If we remove iocbs from the active list after calling ->ki_cancel (but with ctx_lock still held), we can also rely on the invariant thay anything found on the list has a ->ki_cancel callback and can be cancelled, further simplifing the code. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * aio: simplify KIOCB_KEY handlingChristoph Hellwig2018-05-262-9/+7
| | | | | | | | | | | | | | | | | | No need to pass the key field to lookup_iocb to compare it with KIOCB_KEY, as we can do that right after retrieving it from userspace. Also move the KIOCB_KEY definition to aio.c as it is an internal value not used by any other place in the kernel. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * fs: introduce new ->get_poll_head and ->poll_mask methodsChristoph Hellwig2018-05-265-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ->get_poll_head returns the waitqueue that the poll operation is going to sleep on. Note that this means we can only use a single waitqueue for the poll, unlike some current drivers that use two waitqueues for different events. But now that we have keyed wakeups and heavily use those for poll there aren't that many good reason left to keep the multiple waitqueues, and if there are any ->poll is still around, the driver just won't support aio poll. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * fs: add new vfs_poll and file_can_poll helpersChristoph Hellwig2018-05-269-38/+32
| | | | | | | | | | | | | | | | | | These abstract out calls to the poll method in preparation for changes in how we poll. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * fs: update documentation to mention __poll_t and match the codeChristoph Hellwig2018-05-262-2/+2
| | | | | | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * fs: cleanup do_pollfdChristoph Hellwig2018-05-261-25/+23
| | | | | | | | | | | | | | | | | | Use straightline code with failure handling gotos instead of a lot of nested conditionals. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * fs: unexport poll_schedule_timeoutChristoph Hellwig2018-05-262-4/+1
| | | | | | | | | | | | | | | | No users outside of select.c. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * uapi: turn __poll_t sparse checks on by defaultChristoph Hellwig2018-05-261-4/+0
| | | | | | | | Signed-off-by: Christoph Hellwig <hch@lst.de>
| * Merge branch 'fixes' of ↵Christoph Hellwig2018-05-2626-120/+153
| |\ | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs into aio-base
| * | aio: implement io_pgeteventsChristoph Hellwig2018-05-028-11/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the io_getevents equivalent of ppoll/pselect and allows to properly mix signals and aio completions (especially with IOCB_CMD_POLL) and atomically executes the following sequence: sigset_t origmask; pthread_sigmask(SIG_SETMASK, &sigmask, &origmask); ret = io_getevents(ctx, min_nr, nr, events, timeout); pthread_sigmask(SIG_SETMASK, &origmask, NULL); Note that unlike many other signal related calls we do not pass a sigmask size, as that would get us to 7 arguments, which aren't easily supported by the syscall infrastructure. It seems a lot less painful to just add a new syscall variant in the unlikely case we're going to increase the sigset size. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * | aio: implement IOCB_CMD_FSYNC and IOCB_CMD_FDSYNCChristoph Hellwig2018-05-021-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | Simple workqueue offload for now, but prepared for adding a real aio_fsync method if the need arises. Based on an earlier patch from Dave Chinner. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * | aio: refactor read/write iocb setupChristoph Hellwig2018-05-021-69/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't reference the kiocb structure from the common aio code, and move any use of it into helper specific to the read/write path. This is in preparation for aio_poll support that wants to use the space for different fields. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jeff Moyer <jmoyer@redhat.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * | aio: remove the extra get_file/fput pair in io_submit_oneChristoph Hellwig2018-05-021-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we release the lockdep write protection token before calling into ->write_iter and thus never access the file pointer after an -EIOCBQUEUED return from ->write_iter or ->read_iter we don't need this extra reference. Signed-off-by: Christoph Hellwig <hch@lst.de>
| * | aio: sanitize ki_list handlingChristoph Hellwig2018-05-021-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of handcoded non-null checks always initialize ki_list to an empty list and use list_empty / list_empty_careful on it. While we're at it also error out on a double call to kiocb_set_cancel_fn instead of ignoring it. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jeff Moyer <jmoyer@redhat.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * | aio: remove an outdated BUG_ON and comment in aio_completeChristoph Hellwig2018-05-021-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | These days we don't treat sync iocbs special in the aio completion code as they never use it. Remove the old comment and BUG_ON given that the current definition of is_sync_kiocb makes it impossible to hit. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| * | aio: don't print the page size at boot timeChristoph Hellwig2018-05-021-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The page size is in no way related to the aio code, and printing it in the (debug) dmesg at every boot serves no purpose. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jeff Moyer <jmoyer@redhat.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
* | | Merge branch 'work.lookup' of ↵Linus Torvalds2018-06-0426-451/+293
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull dcache lookup cleanups from Al Viro: "Cleaning ->lookup() instances up - mostly d_splice_alias() conversions" * 'work.lookup' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (29 commits) switch the rest of procfs lookups to d_splice_alias() procfs: switch instantiate_t to d_splice_alias() don't bother with tid_fd_revalidate() in lookups proc_lookupfd_common(): don't bother with instantiate unless the file is open procfs: get rid of ancient BS in pid_revalidate() uses cifs_lookup(): switch to d_splice_alias() cifs_lookup(): cifs_get_inode_...() never returns 0 with *inode left NULL 9p: unify paths in v9fs_vfs_lookup() ncp_lookup(): use d_splice_alias() hfsplus: switch to d_splice_alias() hfs: don't allow mounting over .../rsrc hfs: use d_splice_alias() omfs_lookup(): report IO errors, use d_splice_alias() orangefs_lookup: simplify openpromfs: switch to d_splice_alias() xfs_vn_lookup: simplify a bit adfs_lookup: do not fail with ENOENT on negatives, use d_splice_alias() adfs_lookup_byname: .. *is* taken care of in fs/namei.c romfs_lookup: switch to d_splice_alias() qnx6_lookup: switch to d_splice_alias() ...
| * | | switch the rest of procfs lookups to d_splice_alias()Al Viro2018-05-262-5/+13
| | | | | | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>