diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-16 03:11:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-16 03:11:40 -0400 |
commit | a5b729ea18ae601e7aea329e41052bbb861114bd (patch) | |
tree | 5b4a1238fb005e1b48bea893c0827ebb4271c99c | |
parent | 9215310cf13bccfe777500986d562d53bdb63537 (diff) | |
parent | 11c5ad0ec441129adef42c16bbd5139707a8c5b6 (diff) |
Merge branch 'work.aio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
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
-rw-r--r-- | fs/aio.c | 4 | ||||
-rw-r--r-- | fs/eventfd.c | 4 | ||||
-rw-r--r-- | fs/eventpoll.c | 15 | ||||
-rw-r--r-- | include/uapi/linux/aio_abi.h | 2 |
4 files changed, 15 insertions, 10 deletions
@@ -1661,7 +1661,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, | |||
1661 | if (mask && !(mask & req->events)) | 1661 | if (mask && !(mask & req->events)) |
1662 | return 0; | 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 | if (!mask) | 1665 | if (!mask) |
1666 | return 0; | 1666 | return 0; |
1667 | 1667 | ||
@@ -1719,7 +1719,7 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb) | |||
1719 | 1719 | ||
1720 | spin_lock_irq(&ctx->ctx_lock); | 1720 | spin_lock_irq(&ctx->ctx_lock); |
1721 | spin_lock(&req->head->lock); | 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 | if (!mask) { | 1723 | if (!mask) { |
1724 | __add_wait_queue(req->head, &req->wait); | 1724 | __add_wait_queue(req->head, &req->wait); |
1725 | list_add_tail(&aiocb->ki_list, &ctx->active_reqs); | 1725 | list_add_tail(&aiocb->ki_list, &ctx->active_reqs); |
diff --git a/fs/eventfd.c b/fs/eventfd.c index 61c9514da5e9..ceb1031f1cac 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -156,11 +156,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask) | |||
156 | count = READ_ONCE(ctx->count); | 156 | count = READ_ONCE(ctx->count); |
157 | 157 | ||
158 | if (count > 0) | 158 | if (count > 0) |
159 | events |= EPOLLIN; | 159 | events |= (EPOLLIN & eventmask); |
160 | if (count == ULLONG_MAX) | 160 | if (count == ULLONG_MAX) |
161 | events |= EPOLLERR; | 161 | events |= EPOLLERR; |
162 | if (ULLONG_MAX - 1 > count) | 162 | if (ULLONG_MAX - 1 > count) |
163 | events |= EPOLLOUT; | 163 | events |= (EPOLLOUT & eventmask); |
164 | 164 | ||
165 | return events; | 165 | return events; |
166 | } | 166 | } |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 67db22fe99c5..ea4436f409fb 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -922,13 +922,17 @@ static __poll_t ep_read_events_proc(struct eventpoll *ep, struct list_head *head | |||
922 | return 0; | 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 | struct eventpoll *ep = file->private_data; | 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 */ | 932 | static __poll_t ep_eventpoll_poll_mask(struct file *file, __poll_t eventmask) |
931 | poll_wait(file, &ep->poll_wait, wait); | 933 | { |
934 | struct eventpoll *ep = file->private_data; | ||
935 | int depth = 0; | ||
932 | 936 | ||
933 | /* | 937 | /* |
934 | * Proceed to find out if wanted events are really available inside | 938 | * Proceed to find out if wanted events are really available inside |
@@ -968,7 +972,8 @@ static const struct file_operations eventpoll_fops = { | |||
968 | .show_fdinfo = ep_show_fdinfo, | 972 | .show_fdinfo = ep_show_fdinfo, |
969 | #endif | 973 | #endif |
970 | .release = ep_eventpoll_release, | 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 | .llseek = noop_llseek, | 977 | .llseek = noop_llseek, |
973 | }; | 978 | }; |
974 | 979 | ||
diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h index 75846164290e..d00221345c19 100644 --- a/include/uapi/linux/aio_abi.h +++ b/include/uapi/linux/aio_abi.h | |||
@@ -109,7 +109,7 @@ struct iocb { | |||
109 | #undef IFLITTLE | 109 | #undef IFLITTLE |
110 | 110 | ||
111 | struct __aio_sigset { | 111 | struct __aio_sigset { |
112 | sigset_t __user *sigmask; | 112 | const sigset_t __user *sigmask; |
113 | size_t sigsetsize; | 113 | size_t sigsetsize; |
114 | }; | 114 | }; |
115 | 115 | ||