Skip to content

Add locking to modifying operation of the OCS Share API - #22989

Merged
MorrisJobke merged 2 commits into
masterfrom
lock_sharing_ops
May 3, 2016
Merged

MorrisJobke merged 2 commits into
masterfrom
lock_sharing_ops

Conversation

@rullzer

@rullzer rullzer commented Mar 9, 2016

Copy link
Copy Markdown
Contributor

Fixes #17243

This is done in the OCS Share API instead of the share manager since we
want lazy shares in general. However when doing modifying calls via the
OCS Share API it is fine to force real nodes.

  • Updated unit tests to work with logging

CC: @PVince81 @icewind1991 @schiesbn

Comment thread apps/files_sharing/api/share20ocs.php Outdated
}

if (!$this->canAccessShare($share)) {
return new \OC_OCS_Result(null, 404, 'could not delete share');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unlock?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@icewind1991 told me that we unlock anyway when shutting down the request...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would still be good to unlock early like we do in the View.

The reason for unlock on shutdown is just a failsafe in case of uncaught exceptions

@rullzer
rullzer force-pushed the lock_sharing_ops branch 2 times, most recently from d407f82 to 39e2f5d Compare March 23, 2016 07:12
@rullzer

rullzer commented Mar 31, 2016

Copy link
Copy Markdown
Contributor Author

Please rereview

@rullzer

rullzer commented Apr 26, 2016

Copy link
Copy Markdown
Contributor Author

We really need some kind of middleware for OCS as well. because it is not becoming more readable now...

@PVince81 @MorrisJobke please have another look

@MorrisJobke

Copy link
Copy Markdown
Contributor

I tested this and it works. 👍

@MorrisJobke

MorrisJobke commented Apr 26, 2016 •

Copy link
Copy Markdown
Contributor

The only thing I noticed:

The feedback is properly shown, if the sidebar is already open.

@PVince81

Copy link
Copy Markdown
Contributor

@rullzer do you want to fix the web UI part here or separately ?

@rullzer

rullzer commented Apr 30, 2016

Copy link
Copy Markdown
Contributor Author

Lets fix the UI stuff in a different PR

Fixes #17243

This is done in the OCS Share API instead of the share manager since we
want lazy shares in general. However when doing modifying calls via the
OCS Share API it is fine to force real nodes.

* Updated unit tests to work with logging
@rullzer

rullzer commented Apr 30, 2016

Copy link
Copy Markdown
Contributor Author

Rebased to fix the conficts

return $this->getSharedWithMe($path);
$result = $this->getSharedWithMe($path);
if ($path !== null) {
$path->unlock(ILockingProvider::LOCK_SHARED);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why only if $path === null? Do we really want to keep the lock if the path is null? We will leave the method with the return statement below and the file will remain locked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because there is no unlock() method on null ;) It's a !== ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well yeah exactly that ;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah, now I see that you do the unlock directly on $path.... my mistake. I thought that in case of the storage root of shared mount it could be null... But forget about it 😀

@schiessle

Copy link
Copy Markdown
Contributor

Didn't tests it but code looks good 👍

@MorrisJobke

Copy link
Copy Markdown
Contributor

Tested and works 👍

@MorrisJobke
MorrisJobke merged commit 547830d into master May 3, 2016
@MorrisJobke
MorrisJobke deleted the lock_sharing_ops branch May 3, 2016 08:15
@lock

lock Bot commented Aug 6, 2019

Copy link
Copy Markdown

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.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock sharing operations when file is locked

5 participants