Shared Files filesize subtracted from quota + fix/patch
Expected behaviour
User A has quota of 5GB User B has quota of 5GB
User A owns files of summary size 2GB User B owns files of summary size 4GB
User B shares 3GB with User A
User A has still 3GB free space
Actual behaviour
User A has no free space left, his 2GB + Shared 3GB fill up his quota
Steps to reproduce
should be obvious from the above
Server configuration
Operating system: Debian Wheezy
Web server: apache 2.2.22-13
Database: mysql 5.5.30+dfsg-1
PHP version: php5 5.4.4-14
ownCloud version: 5.0.3-0
fix:
for file lib/helper.php
--- helper.php.orig 2013-04-08 20:15:12.071656928 +0200
+++ helper.php 2013-04-08 20:15:51.506027881 +0200
@@ -801,7 +801,8 @@
*/
public static function getStorageInfo() {
$rootInfo = \OC\Files\Filesystem::getFileInfo('/');
- $used = $rootInfo['size'];
+ $sharedInfo = \OC\Files\Filesystem::getFileInfo('/Shared');
+ $used = $rootInfo['size'] - $sharedInfo['size'];
if ($used < 0) {
$used = 0;
}
for file lib/fileproxy/quota.php
--- quota.php.orig 2013-04-08 20:08:48.663494593 +0200
+++ quota.php 2013-04-08 20:12:26.102512891 +0200
@@ -75,7 +75,13 @@
$view = new \OC\Files\View("/".$owner."/files");
$rootInfo = $view->getFileInfo('/');
+ $sharedInfo = $view->getFileInfo('/Shared');
+
$usedSpace = isset($rootInfo['size'])?$rootInfo['size']:0;
+ $sharedSpace = isset($sharedInfo['size'])?$sharedInfo['size']:0;
+
+ $usedSpace = $usedSpace - $sharedSpace;
+
return $totalSpace - $usedSpace;
}
@tron65 can you please submit a pull request? THX
#2504
@DeepDiver1975 i wanted to avoid having to do all the git stuff, as i am not really programming these days. it will take some time for me to get accustomed to it.
anyway, pull request submitted
Please reopen if #2804 didnt fix it for you
The problem still occurs here with v5.0.7 installed from the Ubuntu 13.04 packages: shared files use the quotas of the owner and the users the files are shared with. Is this a regression? It seems the fix was released at version 5.0.5, but I have never used ownCloud before 5.0.7.
the patch/subsequent pull was never incorporated into the main trunk it seems, for whatever reason, at least it is not in the debian packages @ deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/ / i am sure the maintainers have a reason for that, even if it is not clear to me why :)
@tron65 your pull request was rejected - feel free to re-start the discussion in #2804 - THX
I'm reopening this issue as it looks like it has not yet been solved
@VicDeo @bantu any free time at the moment to take a look? Please evaluate if #2804 is a possible solution. In addition: please test the quota with mounted storages
@DeepDiver1975 Please confirm the expected behaviour (quota for user A only considers files owned by A).
@bantu hehe - good point - we need a clear definition of quota actually.
From my understanding the quota should only apply to the users primary local dataspace (stuff under /data/${user}/files). Shared files are not to be counted. Same for external mounted file systems - we actually might need another quota on external storages
@karlitschek @jancborchardt your opinion
I completely agree with how @DeepDiver1975 describes storage management should work. Because files shared with me are not duplicated onto my storage, it should not take away from that. Same for external storages – the data is never duplicated onto my storage either.
While versions and deleted files reside on my storage, they are »shadow files« which will make way for actual data once it’s needed. Hence no need to visualize or inform that I think. (At least not at this point.) cc @schiesbn – but most definitely, versions and deleted files do not count towards storage use either.
Also cc @MTRichards and @owncloud/designers for info, see my previous comment.
For now, as long as we are consistent, I agree with @jancborchardt . As shadow files do not count against quota, we should keep that behavior. However, there are circumstances where you do want them to count against quota. What I would LOVE is a configurable option - so that it can be set by the administrator at the site level in the admin panel.
Example: For this instance of ownCloud, quota should: include files shared with me; only include files I own.
We also have the sticky problem of whether external storage counts against quota or not - but this is an issue to solve later.
However, there are circumstances where you do want them to count against quota.
What are those circumstances? Because if it a file is not actually on the hard drive space reserved for me, it does not seem to make sense to act like it is.
Especially because it is so certain to determine »does this file reside on my storage: yes or no?« (or is it?) a preference seems like making it more complicated than it actually is – which is just having it in the code.
@jancborchardt I agree with you.
In our configuration we have a group that contains ALL users. If one of our 1800 users would choose to share a file of 1GB with that group. Nobody would be able to use it. I would consider this a DoS ;-)
Indeed, at the moment I can't put files onto my owncloud storage, because someone shared his maximum amount of storage (1 GB) with me. I only have 10 MB in use and still my quota is exceeded. It should only count the files that you own.
Its not clear to me if there is a short term plan to fix the current bug of shared storage counting against an individual's quota. The fact, referenced many times in these threads, that you can go over your quota without ever adding a file, shows that quotas are unusable. I've looked at all the references and it seems that fixes aren't planned until OC6 or OC7.
We need a config switch for that. You want to count the shared folder sometimes and sometimes not.
Which one is the most common use case ?
I think it shouldn't be possible for people to "pollute" your storage.
Also, if user1 has 1 GB quota and user2 has 1 GB quota, and the total hard disk space is 2 GB. Currently if user2 shares 1 GB with user1, user1 won't be able to upload anything, which means that 1 GB hard disk space will be available forever, wasted.
Can we make the "not counting /Shared" in a user's quota the default ? The switch (if easy to add) will switch it back to the current behavior.
I'll have a look how difficult it is to implement as it is affecting another fix of mine.