File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
272272 atomic_andnot (IO_POLL_RETRY_FLAG , & req -> poll_refs );
273273 v &= ~IO_POLL_RETRY_FLAG ;
274274 }
275+ v &= IO_POLL_REF_MASK ;
275276 }
276277
277278 /* the mask was stashed in __io_poll_execute */
@@ -304,8 +305,13 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
304305 return IOU_POLL_REMOVE_POLL_USE_RES ;
305306 }
306307 } else {
307- int ret = io_poll_issue ( req , tw ) ;
308+ int ret ;
308309
310+ /* multiple refs and HUP, ensure we loop once more */
311+ if ((req -> cqe .res & (POLLHUP | POLLRDHUP )) && v != 1 )
312+ v -- ;
313+
314+ ret = io_poll_issue (req , tw );
309315 if (ret == IOU_COMPLETE )
310316 return IOU_POLL_REMOVE_POLL_USE_RES ;
311317 else if (ret == IOU_REQUEUE )
@@ -321,7 +327,6 @@ static int io_poll_check_events(struct io_kiocb *req, io_tw_token_t tw)
321327 * Release all references, retry if someone tried to restart
322328 * task_work while we were executing it.
323329 */
324- v &= IO_POLL_REF_MASK ;
325330 } while (atomic_sub_return (v , & req -> poll_refs ) & IO_POLL_REF_MASK );
326331
327332 io_napi_add (req );
You can’t perform that action at this time.
0 commit comments