Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webdav: release locks when deleting #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

klarose
Copy link
Contributor

@klarose klarose commented Jan 22, 2021

The WebDAV RFC indicates that locks rooted on deleted resource MUST be
destroyed. The WebDAV server does not do this with the builtin in-memory
lock system (memLS). This commit adds a new interface, implemented by
memLS, which allows for deleting locks rooted at a given resource.

We added a new interface rather than extending or changing the existing
one to avoid breaking backwards compatibility with other implementations
of the LockSystem interface. The WebDAV server will behave as it used to
if using a LockSystem which has not implemented the new interface.

We apply the same operation for moved files. This follows from the
WebDAV RFC which indicates that a move is logically a copy followed by
consitency checks, followed by a delete of the source.

Fixes golang/go#42839

The WebDAV RFC indicates that locks rooted on deleted resource MUST be
destroyed. The WebDAV server does not do this with the builtin in-memory
lock system (memLS). This commit adds a new interface, implemented by
memLS, which allows for deleting locks rooted at a given resource.

We added a new interface rather than extending or changing the existing
one to avoid breaking backwards compatibility with other implementations
of the LockSystem interface. The WebDAV server will behave as it used to
if using a LockSystem which has not implemented the new interface.

We apply the same operation for moved files. This follows from the
WebDAV RFC which indicates that a move is logically a copy followed by
consitency checks, followed by a delete of the source.

Fixes golang/go#42839
@google-cla google-cla bot added the cla: yes label Jan 22, 2021
// useful when the LockSystem is decoupled from the FileSystem, particularly
// because some FileSystem operations impact the LockSystem (e.g. deleting a
// file).
type LockDeleter interface {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only way I could think of cleaning up locks based on resource name without breaking backwards compatibility with existing implementations of LockSystem. If someone has a better approach in mind, I'm willing to give it a try.

@gopherbot
Copy link
Contributor

This PR (HEAD: b9cf9e4) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/net/+/285753 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

drakkan added a commit to drakkan/sftpgo that referenced this pull request Jul 25, 2021
drakkan added a commit to drakkan/sftpgo that referenced this pull request Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x/net/webdav: delete should release locks
2 participants