-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo: Add a file lock to protect operations against concurrent prune ops
In general, we're pretty robust when there are multiple ongoing operations, because transactions are isolated to per-transaction staging dirs, and the transaction commit is a last-writer-win replace operation on immutable data. However, any non-atomic read operation can fail if it is concurrent with a prune, as then objects may disappear under the operations feet half-way. This patch-set makes this robust by having a repo lock that is taken in a shared fashion for all transactions, and for checkouts, but is taken in exclusive mode for prune. It also adds a non-blocking prune mode that allows you to do opportunistic prunes that don't block if there is an ongoing operation. There are a bunch of operations that are still unsafe (does not block prune), such as: cat, ls, show, log, diff, generate-delta, rev-parse. I don't think that is necessarily a huge problem, as these are mainly used in development or debugging, and a failure here will just be an error printed, it will never cause a broken repo. This is a simpler version of what i proposed at: https://mail.gnome.org/archives/ostree-list/2015-December/msg00024.html - it takes a lock during the whole transaction rather than retrying the transaction under a lock when commiting it. https://bugzilla.gnome.org/show_bug.cgi?id=759442
- Loading branch information
1 parent
480e0ac
commit 7a1f9fd
Showing
6 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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