> Capture trigger queues I/O messages before sending PCM_START. If
> allocation of the START control message fails, trigger returns an
> error with capture I/O messages potentially pending, but without
> marking the stream stopped or arming sync_stop. If sending START
> fails, trigger also leaves transfers enabled. ALSA does not run the
> action undo callback after this trigger failure, so the normal STOP
> path cannot be relied on to drain those requests. Retrying START can
> then submit the same capture messages again.
>
> Disable transfers and mark the stream stopped after a failed start,
> and arm runtime->stop_operating so ALSA invokes sync_stop. Make
> sync_stop send RELEASE when the stream is stopped or has pending
> I/O, and keep the stream stopped when RELEASE or queue draining
> fails. Reject prepare, hw_params, and START retries until a later
> sync_stop resolves the outstanding state.
>
> Always cancel elapsed-period work in sync_stop, even when no RELEASE
> is needed.
>
> Fixes: da76e9f3e43a ("ALSA: virtio: PCM substream operators")
> Assisted-by: LLM
> Signed-off-by: Joonho Lee <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review ยท
https://sashiko.dev/#/patchset/[email protected]?part=2