Repository navigation
Don't block GetAttr/Lookup/ReadDirPlus while a file downloads in Open() - #500
Open
leifrossau wants to merge 1 commit into
Open
leifrossau wants to merge 1 commit into
leifrossau wants to merge 1 commit into
Conversation
Open() held the inode's write lock across hashing and the whole network download, so GetAttr, Lookup and ReadDirPlus on that inode blocked until the download finished. File managers freeze while a large file is being opened. The inode lock is now only taken briefly to read the remote hash and to update the size. Concurrent Opens of the same file are serialized by a per-ID download lock instead, so they still don't download the same file twice. After the download the content is only installed if the inode is still the one registered for that ID and has no local changes. If the inode was replaced in the meantime (e.g. by a delta racing a Lookup), Open() retries with the current inode, or returns ENOENT if the item is gone, rather than returning success with an empty cache file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
Filesystem.Openholds the inode's write lock for the whole hash and download.GetAttr,LookupandReadDirPluson that inode block on the same lock, so a file manager freezes while one large file downloads.Fix
Testing
go build ./...andgo vet ./...pass. The integration tests need a live account, so I haven't run them on this branch. The same change has been running in my fork, where an offline test suite against a mock Graph server covers the replaced-inode retry. Manual check: open a large file and runlsin the same directory while it downloads.Notes for reviewers
hasChangescheck.🤖 Generated with Claude Code