Skip to content

Lock sharing operations when file is locked #17243

Closed

Description

@PVince81

Steps to reproduce

  1. Enable transactional locking
  2. Create two users "user1" and "user2"
  3. Add the following lines:
                    if ($operation === 'unlink') {
                        sleep(30);
                    }

here before this line

if (!is_null($extraParam)) {

(this will delay the delete operation)
4. Create a file "bacon.txt"
5. Start cadaver and delete the file "bacon.txt"
6. During the deletion, in the web UI, share "bacon.txt" with "user2"

Expected result

File cannot be shared because it is locked by the deletion.

Actual result

File can still be shared.
If the file disappears during the sharing logic, there might be unpredictable results as the sharing code assumes the file is still there.

Versions

ownCloud git master (b88a0e7)

@icewind1991 @jnfrmarks @schiesbn

Activity

  1. added this to the milestone on Jun 29, 2015
  2. PVince81 commented on Jun 29, 2015

    @PVince81
    ContributorAuthor

    @DeepDiver1975 @cmonteroluque I scheduled to 8.2, I don't think there is time left for this

  3. PVince81 commented on Jun 29, 2015

    @PVince81
    ContributorAuthor

    In general we should look into locking paths when calling Share APIs (whether share, unshare, unshare from self, etc).

  4. ghost added this to the milestone on Sep 22, 2015
  5. ghost removed this from the milestone on Sep 22, 2015
  6. rullzer commented on Nov 15, 2015

    @rullzer
    Contributor

    So what is the behaviour we want here?

    • Can we still share if there is a read lock?
    • Should we lock if we create/modify a share? (lock exclusive?)
    • Should we read lock if we fetch a share?
  7. PVince81 commented on Nov 16, 2015

    @PVince81
    ContributorAuthor

    Can we still share if there is a read lock?

    Yes, as the action of sharing it doesn't affect it.
    However the question is what happens if the recipient's parent folder (the folder that will receive the share) currently has an exclusive lock 😦
    Maybe that last part should be handled at the time the mount point is created (the one that also resolves naming conflicts), not when the share is created.

    Should we lock if we create/modify a share? (lock exclusive?)

    Not sure. The question is also what to lock, the parent folder ? If creating/modifying a share, it might be enough to set a "shared lock" on the file to prevent people deleting/moving the file while the share is in the process of being created.

    Should we read lock if we fetch a share?

    If with fetching a share you mean getting the contents of the file/folder, we already do that. The shared lock is set on the owner's file/folder.

  8. icewind1991 commented on Nov 16, 2015

    @icewind1991
    Contributor

    I think we only need a read lock when creating a share

  9. rullzer commented on Feb 10, 2016

    @rullzer
    Contributor

    So with the share manager this is getting easier. Since we can do proper locking and unlocking in one place now. However I would like to have locking operations on the node level then. Can that be arranged @icewind1991 ?

    Anyway not 9.0 I think @PVince81 @cmonteroluque

  10. PVince81 commented on Feb 10, 2016

    @PVince81
    ContributorAuthor

    Problem is: the Webdav code doesn't use the Node API... so locking will not happen if we do it on the Node API level.

    However locking is usually done on View level, and the Node API is using the view. Any trouble with this ?

  11. 8 remaining items

  12. icewind1991 commented on Mar 3, 2016

    @icewind1991
    Contributor

    Where you go #22812

  13. rullzer commented on Mar 7, 2016

    @rullzer
    Contributor

    Ok so after looking into this. I don't think we can do the locking in the manager. We also require the manager for ownership transfers (where we require lazy shares). And locking the node makes it so the node has to resolve to something.

    However, I think we can get away here with locking in the OCS Share API. Which is the most logic place anyway. Other parts that want to use the Share Manager have to do their own locking.

  14. added a commit that references this issue on Mar 9, 2016
    28ebe39
  15. ghost added this to the milestone on Mar 9, 2016
  16. ghost removed this from the milestone on Mar 9, 2016
  17. added 2 commits that reference this issue on Mar 17, 2016
    a087586
    cf122bd
  18. added a commit that references this issue on Mar 31, 2016
    29c4ff7
  19. added 2 commits that reference this issue on Apr 26, 2016
    62f5c9e
    62bc531
  20. lock commented on Aug 4, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  21. locked as resolved and limited conversation to collaborators on Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions