@@ -1601,7 +1601,7 @@ static void io_req_complete_post(struct io_kiocb *req, long res,
1601
1601
static inline bool io_req_needs_clean (struct io_kiocb * req )
1602
1602
{
1603
1603
return req -> flags & (REQ_F_BUFFER_SELECTED | REQ_F_NEED_CLEANUP |
1604
- REQ_F_POLLED );
1604
+ REQ_F_POLLED | REQ_F_INFLIGHT );
1605
1605
}
1606
1606
1607
1607
static void io_req_complete_state (struct io_kiocb * req , long res ,
@@ -1717,17 +1717,10 @@ static void io_dismantle_req(struct io_kiocb *req)
1717
1717
{
1718
1718
unsigned int flags = req -> flags ;
1719
1719
1720
+ if (io_req_needs_clean (req ))
1721
+ io_clean_op (req );
1720
1722
if (!(flags & REQ_F_FIXED_FILE ))
1721
1723
io_put_file (req -> file );
1722
- if (io_req_needs_clean (req ) || (req -> flags & REQ_F_INFLIGHT )) {
1723
- io_clean_op (req );
1724
- if (req -> flags & REQ_F_INFLIGHT ) {
1725
- struct io_uring_task * tctx = req -> task -> io_uring ;
1726
-
1727
- atomic_dec (& tctx -> inflight_tracked );
1728
- req -> flags &= ~REQ_F_INFLIGHT ;
1729
- }
1730
- }
1731
1724
if (req -> fixed_rsrc_refs )
1732
1725
percpu_ref_put (req -> fixed_rsrc_refs );
1733
1726
if (req -> async_data )
@@ -6057,6 +6050,12 @@ static void io_clean_op(struct io_kiocb *req)
6057
6050
kfree (req -> apoll );
6058
6051
req -> apoll = NULL ;
6059
6052
}
6053
+ if (req -> flags & REQ_F_INFLIGHT ) {
6054
+ struct io_uring_task * tctx = req -> task -> io_uring ;
6055
+
6056
+ atomic_dec (& tctx -> inflight_tracked );
6057
+ req -> flags &= ~REQ_F_INFLIGHT ;
6058
+ }
6060
6059
}
6061
6060
6062
6061
static int io_issue_sqe (struct io_kiocb * req , unsigned int issue_flags )
0 commit comments