summaryrefslogtreecommitdiff
path: root/fs/aio.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-03-06 18:18:31 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2019-03-17 20:52:30 -0400
commit7425970347a21204632a27ed28978cf875f205b2 (patch)
tree26b28805931efdf7a4377c3b93bff410e328510e /fs/aio.c
parent958c13ce141cd5183d3995553315d0ed27daa823 (diff)
aio: move dropping ->ki_eventfd into iocb_destroy()
no reason to duplicate that... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/aio.c')
-rw-r--r--fs/aio.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 0e0b939958fa..d3837f607d09 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1071,6 +1071,8 @@ out:
static inline void iocb_destroy(struct aio_kiocb *iocb)
{
+ if (iocb->ki_eventfd)
+ eventfd_ctx_put(iocb->ki_eventfd);
if (iocb->ki_filp)
fput(iocb->ki_filp);
percpu_ref_put(&iocb->ki_ctx->reqs);
@@ -1138,10 +1140,8 @@ static void aio_complete(struct aio_kiocb *iocb)
* eventfd. The eventfd_signal() function is safe to be called
* from IRQ context.
*/
- if (iocb->ki_eventfd) {
+ if (iocb->ki_eventfd)
eventfd_signal(iocb->ki_eventfd, 1);
- eventfd_ctx_put(iocb->ki_eventfd);
- }
/*
* We have to order our ring_info tail store above and test
@@ -1807,18 +1807,19 @@ static int __io_submit_one(struct kioctx *ctx, const struct iocb *iocb,
goto out_put_req;
if (iocb->aio_flags & IOCB_FLAG_RESFD) {
+ struct eventfd_ctx *eventfd;
/*
* If the IOCB_FLAG_RESFD flag of aio_flags is set, get an
* instance of the file* now. The file descriptor must be
* an eventfd() fd, and will be signaled for each completed
* event using the eventfd_signal() function.
*/
- req->ki_eventfd = eventfd_ctx_fdget((int) iocb->aio_resfd);
- if (IS_ERR(req->ki_eventfd)) {
- ret = PTR_ERR(req->ki_eventfd);
- req->ki_eventfd = NULL;
+ eventfd = eventfd_ctx_fdget(iocb->aio_resfd);
+ if (IS_ERR(eventfd)) {
+ ret = PTR_ERR(eventfd);
goto out_put_req;
}
+ req->ki_eventfd = eventfd;
}
ret = put_user(KIOCB_KEY, &user_iocb->aio_key);
@@ -1872,8 +1873,6 @@ static int __io_submit_one(struct kioctx *ctx, const struct iocb *iocb,
return 0;
out_put_req:
- if (req->ki_eventfd)
- eventfd_ctx_put(req->ki_eventfd);
iocb_destroy(req);
out_put_reqs_available:
put_reqs_available(ctx, 1);