diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-03-06 18:18:31 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-03-17 20:52:30 -0400 |
commit | 7425970347a21204632a27ed28978cf875f205b2 (patch) | |
tree | 26b28805931efdf7a4377c3b93bff410e328510e /fs | |
parent | 958c13ce141cd5183d3995553315d0ed27daa823 (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')
-rw-r--r-- | fs/aio.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1071,6 +1071,8 @@ out: | |||
1071 | 1071 | ||
1072 | static inline void iocb_destroy(struct aio_kiocb *iocb) | 1072 | static inline void iocb_destroy(struct aio_kiocb *iocb) |
1073 | { | 1073 | { |
1074 | if (iocb->ki_eventfd) | ||
1075 | eventfd_ctx_put(iocb->ki_eventfd); | ||
1074 | if (iocb->ki_filp) | 1076 | if (iocb->ki_filp) |
1075 | fput(iocb->ki_filp); | 1077 | fput(iocb->ki_filp); |
1076 | percpu_ref_put(&iocb->ki_ctx->reqs); | 1078 | percpu_ref_put(&iocb->ki_ctx->reqs); |
@@ -1138,10 +1140,8 @@ static void aio_complete(struct aio_kiocb *iocb) | |||
1138 | * eventfd. The eventfd_signal() function is safe to be called | 1140 | * eventfd. The eventfd_signal() function is safe to be called |
1139 | * from IRQ context. | 1141 | * from IRQ context. |
1140 | */ | 1142 | */ |
1141 | if (iocb->ki_eventfd) { | 1143 | if (iocb->ki_eventfd) |
1142 | eventfd_signal(iocb->ki_eventfd, 1); | 1144 | eventfd_signal(iocb->ki_eventfd, 1); |
1143 | eventfd_ctx_put(iocb->ki_eventfd); | ||
1144 | } | ||
1145 | 1145 | ||
1146 | /* | 1146 | /* |
1147 | * We have to order our ring_info tail store above and test | 1147 | * 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, | |||
1807 | goto out_put_req; | 1807 | goto out_put_req; |
1808 | 1808 | ||
1809 | if (iocb->aio_flags & IOCB_FLAG_RESFD) { | 1809 | if (iocb->aio_flags & IOCB_FLAG_RESFD) { |
1810 | struct eventfd_ctx *eventfd; | ||
1810 | /* | 1811 | /* |
1811 | * If the IOCB_FLAG_RESFD flag of aio_flags is set, get an | 1812 | * If the IOCB_FLAG_RESFD flag of aio_flags is set, get an |
1812 | * instance of the file* now. The file descriptor must be | 1813 | * instance of the file* now. The file descriptor must be |
1813 | * an eventfd() fd, and will be signaled for each completed | 1814 | * an eventfd() fd, and will be signaled for each completed |
1814 | * event using the eventfd_signal() function. | 1815 | * event using the eventfd_signal() function. |
1815 | */ | 1816 | */ |
1816 | req->ki_eventfd = eventfd_ctx_fdget((int) iocb->aio_resfd); | 1817 | eventfd = eventfd_ctx_fdget(iocb->aio_resfd); |
1817 | if (IS_ERR(req->ki_eventfd)) { | 1818 | if (IS_ERR(eventfd)) { |
1818 | ret = PTR_ERR(req->ki_eventfd); | 1819 | ret = PTR_ERR(eventfd); |
1819 | req->ki_eventfd = NULL; | ||
1820 | goto out_put_req; | 1820 | goto out_put_req; |
1821 | } | 1821 | } |
1822 | req->ki_eventfd = eventfd; | ||
1822 | } | 1823 | } |
1823 | 1824 | ||
1824 | ret = put_user(KIOCB_KEY, &user_iocb->aio_key); | 1825 | 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, | |||
1872 | return 0; | 1873 | return 0; |
1873 | 1874 | ||
1874 | out_put_req: | 1875 | out_put_req: |
1875 | if (req->ki_eventfd) | ||
1876 | eventfd_ctx_put(req->ki_eventfd); | ||
1877 | iocb_destroy(req); | 1876 | iocb_destroy(req); |
1878 | out_put_reqs_available: | 1877 | out_put_reqs_available: |
1879 | put_reqs_available(ctx, 1); | 1878 | put_reqs_available(ctx, 1); |