Skip to content

[stable-4.0] fix(filesystem): do not attempt to lock directories on Windows - #10509

Open
backportbot[bot] wants to merge 1 commit into
backport/10470/stable-4.0from
backport/10487/stable-4.0
Open

[stable-4.0] fix(filesystem): do not attempt to lock directories on Windows#10509
backportbot[bot] wants to merge 1 commit into
backport/10470/stable-4.0from
backport/10487/stable-4.0

Conversation

@backportbot

@backportbot backportbot Bot commented Jul 31, 2026

Copy link
Copy Markdown

Backport of PR #10487

@backportbot
backportbot Bot requested review from Aiiaiiio and camilasan as code owners July 31, 2026 08:16
@backportbot
backportbot Bot requested a review from camilasan July 31, 2026 08:16
@backportbot
backportbot Bot requested review from i2h3 and mgallien as code owners July 31, 2026 08:16
@backportbot
backportbot Bot requested a review from claucambra July 31, 2026 08:16
@backportbot
backportbot Bot requested a review from nilsding as a code owner July 31, 2026 08:16
@backportbot backportbot Bot added this to the 4.0.12 milestone Jul 31, 2026
@nilsding
nilsding changed the base branch from stable-4.0 to backport/10470/stable-4.0 July 31, 2026 08:18
LockFile() locks a byte range within a file and is not supported for
directory handles, where it always fails with ERROR_INVALID_PARAMETER.
FILE_FLAG_BACKUP_SEMANTICS lets CreateFileW() open directories, so
isFileLocked() reached that failing call for every directory and logged a
warning for each one. Discovery checks every entry, directories included,
so a sync run logged one bogus warning per directory. On large folder trees
those warnings dominate the log volume, and the resulting log rotation
discards the records needed to diagnose actual problems.

Return the opened handle for directories instead of attempting the lock.
CreateFileW() still runs, so a directory held with deny-sharing is still
reported as locked; only the attempt that cannot succeed is gone.

Measured on a synced folder with 82464 directories, same build and
configuration: a full discovery run logged 83189 of these warnings without
this change and none with it. The added test covers both halves and fails
without the fix. Test suite green on Windows (70 tests).

For #10444

Assisted-by: Claude Code:claude-opus-5
Signed-off-by: Andreas Bohl <ab@eeloy.com>
@nilsding
nilsding force-pushed the backport/10487/stable-4.0 branch from 64bfba6 to fe62aef Compare July 31, 2026 08:19
@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10509.zip

Digest: sha256:f647e224372fb785f7d35de8b8c6e8af2b0f3612225e592bb6d64d219cc40b69

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10509.zip

Digest: sha256:fbd6f0b380f09708ca4b4bede80845dd1cec3f3cd86521b49c4973fa85f3b819

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

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.

3 participants