-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Files added to other users shared folder does not count immediately #14596
Comments
Do you have a very deep folder structure ? Normally upon file upload, the size is updated for every parent folder up to the "files" folder in the database (you can check it in oc_filecache where path = 'files'). Maybe in your case something is delaying that update. |
Can you also post your error log and owncloud log? Maybe they contain related stuff |
error.log:
owncloud.log (during the upload of two files):
All users mentioned in "can not update etags on /files/ for user xxxx" are users in LDAP who did not already logged into owncloud. |
BTW, I can trigger the "quota update" adding a new folder (anywhere) as the user that shares the directory. |
If you point me where in OC code it should update the user quota info, I can debug it myself. |
Hmmm that is a strange set of errors... The code that updates the "size" for all files, which is used for the used space calculation, is here: https://github.com/owncloud/core/blob/master/lib/private/files/cache/cache.php#L597 |
Got a debugger running :-) It seems that oc_filecache is updated as expected. The problem is only with the sharer quota calculation. Where is the user quota updated?
|
@luizluca the usage space of "user1" is calculated by looking at the size of the "files" entry ( |
@PVince81 , I though that files might hold the user used space after I was going home... :-) So, I guess I discovered the problem and I'm starting to ask if ever it worked in any owncloud setup... The folder size is updated using this function: OC\Files\Cache\Cache->correctFolderSize() at /srv/www/htdocs/owncloud/lib/private/files/cache/cache.php:569
public function correctFolderSize($path, $data = null) {
$this->calculateFolderSize($path, $data);
if ($path !== '') {
$parent = dirname($path);
if ($parent === '.' or $parent === '/') {
$parent = '';
}
$this->correctFolderSize($parent);
}
} Where calculateFolderSize can be implemented by Cache or its decedents: HomeCache and Shared_Cache (which calls cache::correctFolderSize). Their implementation are correct, as folder size is updated when called. correctFolderSize updates size for a path and recursively calls itself until path is ''. For a user accessing its own folder, I get these calls: user1: info: actually, it is all those twice. The first with filesize=0 (file creation?) and the second one with While when another user writes to the shared csit-scd folder, I get: user2: It never goes down the shared folder. So, calculateFolderSize is never called for user1 "files". I do not see another place in code that does this recursion. and subclasses do not replace correctFolderSize. So, I guess there is no place for files to get updated when user2 is writing. |
Hmm... this used to work in OC 6. If user2 changes a file that belongs to user1, then the shared storage should propagate the size change to user1's storage. |
Also, to make sure there is no misunderstanding: the used space only counts for file owners. So if user1 is the owner of the "csit-csd" folder, then any file modified inside still counts in user1's quota, even if it's user2 accessing it. |
Yes, I guess there is no misunderstanding. the problem is that user1 quota is not changed when user2 writes to user1 shared folder. It is only a propagation problem as any modification in any user1 files by user1 generates the updates until the files folder. At this point, any modification that user2 did inside the shared folder starts to count. |
Thanks a lot for your analysis, I need to look into this. |
@icewind1991 did anything change in OC 8 in regards to size propagation ? |
Steps to reproduce:
Expected: 10 MB used |
Also observed on 7.0.4. It looks like the size (and etag) propagates only up to the "test" folder, but doesn't reach the "files" entry. |
This is the initial situation:
Now if I upload a file as user2 into "test":
|
Neither the size nor the etag of the root "files" of the owner was changed. Testing on OC 6.0.6:
After upload:
AHA! So it worked in OC 6! (CC @guruz) I was pretty sure I fixed this in OC 6 but the many changes done to the shared folder possibly reintroduced this problem in OC 7... |
Another test case with subdirs on stable7. "test" is shared with "user2".
After upload:
Here again we see that the propagation of size+etag stops at the owner's shared folder. |
Work in progress here: #14720 |
I think I'll split the size propagation logic from etag. The reason is that the size only needs to be propagated to the owner. But for etags, the change must appear for every recipient! Which is another algorithm... |
I raised a separate ticket for the etag propagation to avoid confusion: #14726 Let's keep this ticket here solely for the size propagation. |
Fix was merged: #14720 |
Hello
I'm having problems with OC8.0 regard the quota with shared folders. Files added to other user's shared folder does not count until I manually rescan the folder.
What happens:
6a. Acoording to past OC doc, A should have its quota used (https://doc.owncloud.org/server/6.0/user_manual/files/quota.html), and this is what I wanted
6b. Acoording to OC8.0 doc, B should have its quota used (https://doc.owncloud.org/server/8.0/user_manual/files/quota.html)
The expected result would be:
6a. user B adds 50MB of files to folder F (user A quota is used)
or
6b. user B adds 50MB of files to folder F (user B quota is used)
In case of 6a:
7. user B adds 50MB of files to folder F. Fails with over quota usage
If I trigger a file-scan manually for user A (./occ files:scan --path="/A/"), its quota is updated correctly according to 6a (not 6b) (It is not what docs say but I guess it makes a little more sense).
If 7. is retried after the rescan, it recieves an over quota error.
The same problem of not updating user A quota happens when user B removes a file from folder F.
It seems that, at least, the quota checking is correct. At step 6., if user try to upload 100MB, OC avoids telling that there is not enough space. However, I can upload less than 90MB multiple times as user A quota is not updated.
The text was updated successfully, but these errors were encountered: