Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decomposedfs: add locking support (#2460)
* decomposedfs: add locking support Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * add lock implementation, refactor error handling Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * introduce lock ctx Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * add locked error and status code mapping Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * read lockid from opaque into ctx for delete Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * decomposedfs: make delete respect lock Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: simplify error code mapping Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * adjust to cs3 lock api update Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * utils: add and read plain opaque entries Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * fix delete lock Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * invalidate stat cache when setting lock Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * fix a few linter items Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * linter happyness Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: implment unlock Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * lock caching and unlocking Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * read locks on folders Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * check lock on writes Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * always assume locktype write Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocis only supports exclusive locks Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * add precodition failed errtype * handle preconditionfailed in status conversion * omit empty xml tags in lockdiscovery * handle locked status on LOCK * document oc10 lock behaviour as comment * ocdav: handle errors for LOCK and UNLOCK * storage: change fs.Unlock signature * decomposedfs: refactor checkLock * add LookupReferenceForPath comment Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * gateway: ignore unimplemented add/denyGrant response Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * use http.StatusMethodNotAllowed for mkcol error case Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * make hound happy Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: be more tolerant with the Lock-Token header Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: allow setting infinity timeout Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: use custem owner innerxml without href * update expected failures * ocdav: return conflict on missing intermediate target dir Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * decomposedfs: use checkLock() in the rest of cases Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * Do not choke when checking the lock of non-existent nodes * Linter fixes * Refactor: Move lock handling into the node domain * Also delete the lock file when deleting a node * Extract node lock-handling code into separate file, start writing tests * Add missing license header * Fix relocking already-locked nodes. Increase test coverage * Hounds be happy * Add unit tests for ReadLock and RefreshLock * Also cover readLocksIntoOpaque in the tests * Fix linter issue * Do not log full nodes, it's very expensive and not very helpful * Start adding grpc integration tests for locking * Fix setting the lock for file uploads * Allow for locking space-based resources * Make sure to log the error before it's getting overwritten * reuse xml.EscapeText directly Co-authored-by: David Christofas <dchristofas@posteo.de> * decomposedfs: use defer to close file when unlocking resource Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: explain why some http states are commented Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * ocdav: use http header status constants Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * clarify add/deny grant log Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * update expected failures Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: André Duffeck <andre.duffeck@firondu.de> Co-authored-by: David Christofas <dchristofas@posteo.de>
- Loading branch information