Skip to content

Commit a5b729e

Browse files
committed
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
2 parents 9215310 + 11c5ad0 commit a5b729e

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

fs/aio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
16611661
if (mask && !(mask & req->events))
16621662
return 0;
16631663

1664-
mask = file->f_op->poll_mask(file, req->events);
1664+
mask = file->f_op->poll_mask(file, req->events) & req->events;
16651665
if (!mask)
16661666
return 0;
16671667

@@ -1719,7 +1719,7 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb)
17191719

17201720
spin_lock_irq(&ctx->ctx_lock);
17211721
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;
17231723
if (!mask) {
17241724
__add_wait_queue(req->head, &req->wait);
17251725
list_add_tail(&aiocb->ki_list, &ctx->active_reqs);

fs/eventfd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
156156
count = READ_ONCE(ctx->count);
157157

158158
if (count > 0)
159-
events |= EPOLLIN;
159+
events |= (EPOLLIN & eventmask);
160160
if (count == ULLONG_MAX)
161161
events |= EPOLLERR;
162162
if (ULLONG_MAX - 1 > count)
163-
events |= EPOLLOUT;
163+
events |= (EPOLLOUT & eventmask);
164164

165165
return events;
166166
}

fs/eventpoll.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -922,13 +922,17 @@ static __poll_t ep_read_events_proc(struct eventpoll *ep, struct list_head *head
922922
return 0;
923923
}
924924

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)
926927
{
927928
struct eventpoll *ep = file->private_data;
928-
int depth = 0;
929+
return &ep->poll_wait;
930+
}
929931

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;
932936

933937
/*
934938
* Proceed to find out if wanted events are really available inside
@@ -968,7 +972,8 @@ static const struct file_operations eventpoll_fops = {
968972
.show_fdinfo = ep_show_fdinfo,
969973
#endif
970974
.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,
972977
.llseek = noop_llseek,
973978
};
974979

include/uapi/linux/aio_abi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct iocb {
109109
#undef IFLITTLE
110110

111111
struct __aio_sigset {
112-
sigset_t __user *sigmask;
112+
const sigset_t __user *sigmask;
113113
size_t sigsetsize;
114114
};
115115

0 commit comments

Comments
 (0)