Skip to content

Allow sub-locking with acquired exclusive lock - #17164

Closed
nickvergessen wants to merge 4 commits into
masterfrom
allow-locking-with-acquired-exclusive-lock
Closed

nickvergessen wants to merge 4 commits into
masterfrom
allow-locking-with-acquired-exclusive-lock

Conversation

@nickvergessen

Copy link
Copy Markdown
Contributor

We need a way so that subcalls of the same process can try to get locks.
This is required because storage wrappers and hooks are within the parent lock,
but currently fail to be allowed to get locks, because the file is already locked.

So I added local lock tracking, if we have an exclusive lock already. The memcache lock
can only be released when we have no more local locks. This allows subsequent calls of the
same process to lock and release files just normally.
This thereby fixes the problem of the encryption storage wrapper that makes smashbox fail, see #17029 for more details.

Fixes #17029

@PVince81 @icewind1991 @DeepDiver1975 @schiesbn

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@nickvergessen

Copy link
Copy Markdown
Contributor Author

Will create a full smashbox overview over lunch

@icewind1991

Copy link
Copy Markdown
Contributor

👎

I don't think this is the correct way to solve the problem, having the lock actually lock the file even for the current process prevents getting unexpected results when trying to do fs work in the middle of an existing fs operation, having a storage wrapper call getFileInfo on a file that hasn't been created yet should not return an unspecified maybe-valid-but-relies-completely-on-the-storage-backend result, this should return an error value (or an exception, a man can dream...).

A write lock is not just to keep other processes from reading the file, it should also prevent the same process from reading the file since we can't guarantee correct behavior when reading a file that's being written to.

In the past we've had to fix multiple bugs that we're caused by wrappers/hooks/etc interfering with filesystem operations. Locking should make filesystem operations atomic and prevent unexpected behavior, something we cant do if the same process can simply ignore the lock.

@PVince81

Copy link
Copy Markdown
Contributor

@nickvergessen can you run the loop=10 case you had before on this branch ?
Might help find out if it's related to double-locking within a single PHP request.

@nickvergessen

Copy link
Copy Markdown
Contributor Author

Done with locking for today => monday

@nickvergessen
nickvergessen deleted the allow-locking-with-acquired-exclusive-lock branch July 3, 2015 07:00
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 11, 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.

Move in, Move in overwrite and Move out fail using WebDAV with locking

4 participants