public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [REGRESSION] io_uring: final close can hang on a stopped submitter
@ 2026-10-27  4:35 Karl Mehltretter
  2026-10-27 18:04 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Karl Mehltretter @ 2026-10-27  4:35 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Karl Mehltretter, io-uring, regressions, linux-kernel

Commit 13d3783a55b7 ("io_uring: wait for in-flight requests on ring
release") can make the final close of a shared ring wait for task_work
owned by a stopped submitter. The close does not return until that task
resumes.

An LLM helped with the review and reproducer.

#regzbot introduced: 13d3783a55b758a9fa05b67835afa7e216476c61

Last good: v7.3, c03c1a14507dfaf8b856c2608f9ac216021fc222
Tested bad: d135ab453a7400a34930bdda1ef4bdc8acfac80e
            (master as of 2026-10-27)

The reproducer uses a default ring and three processes:

  1. Submitter B creates the ring and submits POLL_ADD on an empty pipe.
  2. B forks closer A. A inherits the ring fd but starts without an
     io_uring task context.
  3. A unmaps the ring but keeps its fd. B drops its fd and mappings,
     then stops itself with SIGSTOP.
  4. After confirming that B is stopped, controller P tells A to close
     the final ring fd.
  5. P resumes B after two seconds so the test can finish.

B keeps both pipe ends open and remains alive until close returns. This
excludes pipe HUP and process exit as completion sources.

Tested with QEMU 11.0.2, arm64 virt/cortex-a57, two vCPUs,
CONFIG_IO_URING=y, and CONFIG_PREEMPT=y:

  v7.3: close returned in 0 ms
  d135ab453a74: close returned after 2005 ms, immediately after B resumed

Regards,
Karl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [REGRESSION] io_uring: final close can hang on a stopped submitter
  2026-10-27  4:35 [REGRESSION] io_uring: final close can hang on a stopped submitter Karl Mehltretter
@ 2026-10-27 18:04 ` Jens Axboe
  2026-10-27 20:45   ` Karl Mehltretter
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2026-10-27 18:04 UTC (permalink / raw)
  To: Karl Mehltretter; +Cc: io-uring, regressions, linux-kernel

On 10/26/26 10:35 PM, Karl Mehltretter wrote:
> Commit 13d3783a55b7 ("io_uring: wait for in-flight requests on ring
> release") can make the final close of a shared ring wait for task_work
> owned by a stopped submitter. The close does not return until that task
> resumes.
> 
> An LLM helped with the review and reproducer.
> 
> #regzbot introduced: 13d3783a55b758a9fa05b67835afa7e216476c61
> 
> Last good: v7.3, c03c1a14507dfaf8b856c2608f9ac216021fc222
> Tested bad: d135ab453a7400a34930bdda1ef4bdc8acfac80e
>             (master as of 2026-10-27)
> 
> The reproducer uses a default ring and three processes:
> 
>   1. Submitter B creates the ring and submits POLL_ADD on an empty pipe.
>   2. B forks closer A. A inherits the ring fd but starts without an
>      io_uring task context.
>   3. A unmaps the ring but keeps its fd. B drops its fd and mappings,
>      then stops itself with SIGSTOP.
>   4. After confirming that B is stopped, controller P tells A to close
>      the final ring fd.
>   5. P resumes B after two seconds so the test can finish.
> 
> B keeps both pipe ends open and remains alive until close returns. This
> excludes pipe HUP and process exit as completion sources.

This is working as intended. With the change, close() waits for
requests still in flight, as otherwise they keep files pinned after
the ring is gone. If you SIGSTOP a task, then that task can't run
the required work to complete it. A fatal signal will still kill
it.

Unsurprisingly, sending SIGSTOP to something may prevent it from
doing work...

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [REGRESSION] io_uring: final close can hang on a stopped submitter
  2026-10-27 18:04 ` Jens Axboe
@ 2026-10-27 20:45   ` Karl Mehltretter
  0 siblings, 0 replies; 3+ messages in thread
From: Karl Mehltretter @ 2026-10-27 20:45 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, regressions, linux-kernel

On Tue, Oct 27, 2026 at 12:04:59PM +0100, Jens Axboe wrote:
> >   3. A unmaps the ring but keeps its fd. B drops its fd and mappings,
> >      then stops itself with SIGSTOP.
> >   4. After confirming that B is stopped, controller P tells A to close
> >      the final ring fd.
> >   5. P resumes B after two seconds so the test can finish.
> > 
> > B keeps both pipe ends open and remains alive until close returns. This
> > excludes pipe HUP and process exit as completion sources.
> 
> This is working as intended. With the change, close() waits for
> requests still in flight, as otherwise they keep files pinned after
> the ring is gone. If you SIGSTOP a task, then that task can't run
> the required work to complete it. A fatal signal will still kill
> it.
> 
> Unsurprisingly, sending SIGSTOP to something may prevent it from
> doing work...
> 

Good point. This is not a real regression.

Thanks,
Karl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-27 20:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27  4:35 [REGRESSION] io_uring: final close can hang on a stopped submitter Karl Mehltretter
2026-10-27 18:04 ` Jens Axboe
2026-10-27 20:45   ` Karl Mehltretter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox