Pull aio fixes from Al Viro: "Assorted AIO followups and fixes" * 'work.aio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: eventpoll: switch to ->poll_mask aio: only return events requested in poll_mask() for IOCB_CMD_POLL eventfd: only return events requested in poll_mask() aio: mark __aio_sigset::sigmask const
Unified · Split
| @@ -1661,7 +1661,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 1660 unmodified lines | ||
| 1661 | 1661 | if (mask && !(mask & req->events)) |
| 1662 | 1662 | return 0; |
| 1663 | 1663 | |
| 1664 | − mask = file->f_op->poll_mask(file, req->events); | |
| 1664 | + mask = file->f_op->poll_mask(file, req->events) & req->events; | |
| 1665 | 1665 | if (!mask) |
| 1666 | 1666 | return 0; |
| 1667 | 1667 | |
| @@ -1719,7 +1719,7 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb) · 51 unmodified lines | ||
| 1719 | 1719 | |
| 1720 | 1720 | spin_lock_irq(&ctx->ctx_lock); |
| 1721 | 1721 | spin_lock(&req->head->lock); |
| 1722 | − mask = req->file->f_op->poll_mask(req->file, req->events); | |
| 1722 | + mask = req->file->f_op->poll_mask(req->file, req->events) & req->events; | |
| 1723 | 1723 | if (!mask) { |
| 1724 | 1724 | __add_wait_queue(req->head, &req->wait); |
| 1725 | 1725 | list_add_tail(&aiocb->ki_list, &ctx->active_reqs); |
| @@ -156,11 +156,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask) · 155 unmodified lines | ||
| 156 | 156 | count = READ_ONCE(ctx->count); |
| 157 | 157 | |
| 158 | 158 | if (count > 0) |
| 159 | − events |= EPOLLIN; | |
| 159 | + events |= (EPOLLIN & eventmask); | |
| 160 | 160 | if (count == ULLONG_MAX) |
| 161 | 161 | events |= EPOLLERR; |
| 162 | 162 | if (ULLONG_MAX - 1 > count) |
| 163 | − events |= EPOLLOUT; | |
| 163 | + events |= (EPOLLOUT & eventmask); | |
| 164 | 164 | |
| 165 | 165 | return events; |
| 166 | 166 | } |
| @@ -922,13 +922,17 @@ static __poll_t ep_read_events_proc(struct eventpoll *ep, struct list_head *head · 921 unmodified lines | ||
| 922 | 922 | return 0; |
| 923 | 923 | } |
| 924 | 924 | |
| 925 | −static __poll_t ep_eventpoll_poll(struct file *file, poll_table *wait) | |
| 925 | +static struct wait_queue_head *ep_eventpoll_get_poll_head(struct file *file, | |
| 926 | + __poll_t eventmask) | |
| 926 | 927 | { |
| 927 | 928 | struct eventpoll *ep = file->private_data; |
| 928 | − int depth = 0; | |
| 929 | + return &ep->poll_wait; | |
| 930 | +} | |
| 929 | 931 | |
| 930 | − /* Insert inside our poll wait queue */ | |
| 931 | − poll_wait(file, &ep->poll_wait, wait); | |
| 932 | +static __poll_t ep_eventpoll_poll_mask(struct file *file, __poll_t eventmask) | |
| 933 | +{ | |
| 934 | + struct eventpoll *ep = file->private_data; | |
| 935 | + int depth = 0; | |
| 932 | 936 | |
| 933 | 937 | /* |
| 934 | 938 | * Proceed to find out if wanted events are really available inside |
| @@ -968,7 +972,8 @@ static const struct file_operations eventpoll_fops = { · 33 unmodified lines | ||
| 968 | 972 | .show_fdinfo = ep_show_fdinfo, |
| 969 | 973 | #endif |
| 970 | 974 | .release = ep_eventpoll_release, |
| 971 | − .poll = ep_eventpoll_poll, | |
| 975 | + .get_poll_head = ep_eventpoll_get_poll_head, | |
| 976 | + .poll_mask = ep_eventpoll_poll_mask, | |
| 972 | 977 | .llseek = noop_llseek, |
| 973 | 978 | }; |
| 974 | 979 | |
| @@ -109,7 +109,7 @@ struct iocb { · 108 unmodified lines | ||
| 109 | 109 | #undef IFLITTLE |
| 110 | 110 | |
| 111 | 111 | struct __aio_sigset { |
| 112 | − sigset_t __user *sigmask; | |
| 112 | + const sigset_t __user *sigmask; | |
| 113 | 113 | size_t sigsetsize; |
| 114 | 114 | }; |
| 115 | 115 | |