File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1236,13 +1236,18 @@ static void io_req_local_work_add(struct io_kiocb *req)
1236
1236
{
1237
1237
struct io_ring_ctx * ctx = req -> ctx ;
1238
1238
1239
- if (!llist_add (& req -> io_task_work .node , & ctx -> work_llist ))
1239
+ percpu_ref_get (& ctx -> refs );
1240
+
1241
+ if (!llist_add (& req -> io_task_work .node , & ctx -> work_llist )) {
1242
+ percpu_ref_put (& ctx -> refs );
1240
1243
return ;
1244
+ }
1241
1245
/* need it for the following io_cqring_wake() */
1242
1246
smp_mb__after_atomic ();
1243
1247
1244
1248
if (unlikely (atomic_read (& req -> task -> io_uring -> in_idle ))) {
1245
1249
io_move_task_work_from_local (ctx );
1250
+ percpu_ref_put (& ctx -> refs );
1246
1251
return ;
1247
1252
}
1248
1253
@@ -1252,6 +1257,7 @@ static void io_req_local_work_add(struct io_kiocb *req)
1252
1257
if (ctx -> has_evfd )
1253
1258
io_eventfd_signal (ctx );
1254
1259
__io_cqring_wake (ctx );
1260
+ percpu_ref_put (& ctx -> refs );
1255
1261
}
1256
1262
1257
1263
void __io_req_task_work_add (struct io_kiocb * req , bool allow_local )
You can’t perform that action at this time.
0 commit comments