target: roll back activation state on failed activation - #6
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Target.activate() activates the suppliers of a client recursively. If one of the activation steps fails, the suppliers that were already activated remain active. Keep track of the objects activated during the current call and deactivate them in reverse order if activation fails. Rollback errors are logged while the original activation error is kept. Add tests for direct activation failures, nested suppliers, and already active suppliers. Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Conflict resolution can deactivate clients that were active before a new activation was started. In this case, rolling back only the newly activated objects does not restore the original target state. Save the active resources and drivers before activation and try to activate them again if they were deactivated during a failed activation. Errors during rollback or restoration should not replace the original activation error. Add tests for restoring conflicting drivers and for failures during restoration. Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
2891648 to
2dc0fb7
Compare
LLM reviewThis series fixes Session: 33240410294 AnalysisNo CI logs or PR discussion were available specific to this exact commit range (CI notes Independently traced
Restore ordering correctness relies on No functional bug found; no fixup patches suggested. CI warningsCI notes for this run were empty, so no CI annotations could be reviewed. Verification dataNo datasheets/binary artifacts involved. Verification was code-only:
Suggested patchesNone. Both issues flagged in earlier review rounds of this change are already resolved in Install instructionsThe following one-liner installs the script if not present already: curl -fSsL "https://raw.githubusercontent.com/analogdevicesinc/doctools/refs/heads/main/ci/scripts/apply-patches.sh" -o ~/.local/bin/apply-patches.sh && grep -q "/apply-patches.sh" ~/.bashrc || echo "source ~/.local/bin/apply-patches.sh" >> $_ ; . $_More information at AI Usage. |
Target.activate()activates suppliers recursively before activating the requested client. If a later activation step fails, previously activated suppliers could remain active while the failed client stayed bound.This could leave shared agents, USB interfaces, ports, locks, or other resources in a stale state and cause subsequent activation attempts to fail.
This issue was encountered while extending FT232H/FTDI GPIO support.
The FTDI driver acquires a shared agent before calling
proxy.setup(). When setup fails, the driver must release the agent and restore the FTDI interface state itself. This driver-specific cleanup exposed a more general lifecycle problem inTarget.activate().