Return queued buffers on stream start failure - #57
Open
grawis wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
start_streaming()fails after buffers have been queued to the driver, vb2 requires the driver to return all owned buffers.Previously,
vcam_start_streaming()returned immediately whenkthread_create()failed, leaving buffers in the active queue. This can violate the vb2start_streaming()failure contract.Drain the active queue under the driver lock and return each buffer with
VB2_BUF_STATE_QUEUEDbefore propagating thekthread_create()error.Build-tested with Linux 6.17.0-23-generic headers.
Summary by cubic
Return queued buffers when
start_streaming()fails to create the submitter thread, complying with the vb2 failure contract. Previously we returned-ECANCELEDand left buffers in the active queue; now we drain the queue, complete buffers asVB2_BUF_STATE_QUEUED, and propagate the actualkthread_create()error.vcam_return_queued_buffers()to drainvcam_out_vidq.activeunderout_q_slock.IS_ERR()/PTR_ERR()forkthread_create(), setssub_thr_idtoNULL, and returns the real error code.wake_up_process(); normal start behavior is unchanged.-ENOMEM,-EINTR) instead of-ECANCELED.Written for commit 081d978. Summary will update on new commits.