Skip to content

fix(files): release locks when basic operations fail#62428

Draft
joshtrichards wants to merge 2 commits into
masterfrom
jtr/fix-locking-basicOperation
Draft

fix(files): release locks when basic operations fail#62428
joshtrichards wants to merge 2 commits into
masterfrom
jtr/fix-locking-basicOperation

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Jul 22, 2026

Copy link
Copy Markdown
Member
  • Resolves: # (hard to say)

Summary

Ensure View::basicOperation() always releases the currently held lock when an exception occurs after locking, including failures from filesystem hooks, path resolution, storage operations, cache updates, and post-hooks.

Successful fopen() calls continue to transfer lock cleanup to the wrapped stream callback.

Adds regression coverage for a throwing pre-write hook to verify no lock remains afterward.

Use the same pattern as PR #62427, which was/is for streamed View::file_put_contents().

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Ensure View::basicOperation() releases the currently held lock when pre/post hooks, path resolution, storage calls, or cache updates throw.

Keep successful fopen() lock ownership with the wrapped stream callback.

Modernize: Move guards to the top to flatten logic/improve readability.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Assisted-by: Copilot:GPT-5.6

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 35 milestone Jul 22, 2026
@joshtrichards joshtrichards changed the title Jtr/fix locking basic operation fix(files): release locks when basic operations fail Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants