Bug 12145 - smbd: if inherit owner is enabled, the free disk on a folder should take the owner's quota into account
Summary: smbd: if inherit owner is enabled, the free disk on a folder should take the ...
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.5.0rc1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2016-08-12 12:40 UTC by Uri Simchoni
Modified: 2016-09-20 07:04 UTC (History)
3 users (show)

See Also:

git-am fix for 4.5.0 (33.09 KB, patch)
2016-08-14 17:32 UTC, Uri Simchoni
jra: review+
git-am fix for 4.4.next (33.99 KB, patch)
2016-08-14 17:36 UTC, Uri Simchoni
jra: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Uri Simchoni 2016-08-12 12:40:22 UTC
Samba reports disk size and remaining free space (such as when running "dir" in a cmd window on a Windows machine). When quotas are enabled, these numbers are clamped by the quota of the user querying for disk size and remaining free space. 

The free space is consulted by some client applications. For example, Windows Explorer won't copy a file into a folder if that would exceed the remaining free space. In SMB2 protocol, disk size / free space query is relative to a directory, i.e. it allows querying the free space of each directory separately.

When "inherit owner" is enabled, created files and directories receive the owner of their parent directory, and hence the quota that affects the available space is mostly that of the directory owner, not the quota of the user making the request. It is this quota that should be used for calculations to give users the right number, and to give clients the correct hint.
Comment 1 Uri Simchoni 2016-08-14 17:32:06 UTC
Created attachment 12365 [details]
git-am fix for 4.5.0

About the 4.5.0 fix - there's one commit marked as "backported", since in that version lp_inherit_owner() returns a bool. Other than that it's a clean cherry-picking.
Comment 2 Uri Simchoni 2016-08-14 17:36:04 UTC
Created attachment 12366 [details]
git-am fix for 4.4.next

About the 4.4.x fix - there are two commits marked as "backported":
- one because in that version lp_inherit_owner() returns a bool
- another because the dfree tests have changed slightly due to cleanups in 4.5.

Additionally there's a one-line additional patch to facilitate the last patch. I've taken the liberty of marking it with Jeremy's RB+, so if someone else ends up reviewing it please pay attention.
Comment 3 Uri Simchoni 2016-08-16 04:04:02 UTC
Assigning to Karolin for inclusion in 4.5.0 and 4.4.next
Comment 4 Stefan Metzmacher 2016-08-24 09:45:44 UTC
Pushed to autobuild-v4-5-test.
Comment 5 Stefan Metzmacher 2016-08-28 15:52:22 UTC
Pushed to v4-5-test.
Comment 6 Karolin Seeger 2016-09-13 09:51:21 UTC
Pushed to autobuild-v4-4-test.
Comment 7 Karolin Seeger 2016-09-20 07:04:20 UTC
Pushed to both branches.
Closing out bug report.