aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-04-13 13:50:54 -0400
committerJens Axboe <axboe@kernel.dk>2019-04-13 21:08:22 -0400
commit3d6770fbd9353988839611bab107e4e891506aad (patch)
tree5269b98bee6e45d1230a59454b97fec30cb64b6a
parent77f1e0a52d26242b6c2dba019f6ebebfb9ff701e (diff)
io_uring: drop io_file_put() 'file' argument
Since the fget/fput handling was reworked in commit 09bb839434bd, we never call io_file_put() with state == NULL (and hence file != NULL) anymore. Remove that case. Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 24355e0c47f0..f4ddb9d23241 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -682,11 +682,9 @@ static void io_iopoll_req_issued(struct io_kiocb *req)
682 list_add_tail(&req->list, &ctx->poll_list); 682 list_add_tail(&req->list, &ctx->poll_list);
683} 683}
684 684
685static void io_file_put(struct io_submit_state *state, struct file *file) 685static void io_file_put(struct io_submit_state *state)
686{ 686{
687 if (!state) { 687 if (state->file) {
688 fput(file);
689 } else if (state->file) {
690 int diff = state->has_refs - state->used_refs; 688 int diff = state->has_refs - state->used_refs;
691 689
692 if (diff) 690 if (diff)
@@ -711,7 +709,7 @@ static struct file *io_file_get(struct io_submit_state *state, int fd)
711 state->ios_left--; 709 state->ios_left--;
712 return state->file; 710 return state->file;
713 } 711 }
714 io_file_put(state, NULL); 712 io_file_put(state);
715 } 713 }
716 state->file = fget_many(fd, state->ios_left); 714 state->file = fget_many(fd, state->ios_left);
717 if (!state->file) 715 if (!state->file)
@@ -1671,7 +1669,7 @@ out:
1671static void io_submit_state_end(struct io_submit_state *state) 1669static void io_submit_state_end(struct io_submit_state *state)
1672{ 1670{
1673 blk_finish_plug(&state->plug); 1671 blk_finish_plug(&state->plug);
1674 io_file_put(state, NULL); 1672 io_file_put(state);
1675 if (state->free_reqs) 1673 if (state->free_reqs)
1676 kmem_cache_free_bulk(req_cachep, state->free_reqs, 1674 kmem_cache_free_bulk(req_cachep, state->free_reqs,
1677 &state->reqs[state->cur_req]); 1675 &state->reqs[state->cur_req]);