mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
smbd: dfree - ignore quota if not enforced
When calculating free disk space, do not take user quota into account if quota is globally not enforced on the file system. This is meant to fix a specific problem with XFS. One might say "why don't you fix the XFS-specific code instead?". The reason for that is that getting and setting quota must not be affected by whether quota is actually enforced. NTFS has the same notion of separating quota accounting (and being able to configure / retrieve configured quota), from quota enforcement. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11937 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat May 28 00:09:05 CEST 2016 on sn-devel-144
This commit is contained in:
parent
de2d624d07
commit
42151f6fa2
@ -330,5 +330,3 @@
|
||||
# ad_dc requires signing
|
||||
#
|
||||
^samba4.smb.signing.*disabled.*signing=off.*\(ad_dc\)
|
||||
#new disk-free tests fail the code
|
||||
^samba3.blackbox.dfree_quota \(fileserver\).Test dfree share root quota not enforced\(fileserver\)
|
||||
|
@ -489,9 +489,24 @@ bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
|
||||
SMB_DISK_QUOTA D;
|
||||
unid_t id;
|
||||
|
||||
id.uid = geteuid();
|
||||
/*
|
||||
* First of all, check whether user quota is
|
||||
* enforced. If the call fails, assume it is
|
||||
* not enforced.
|
||||
*/
|
||||
ZERO_STRUCT(D);
|
||||
id.uid = -1;
|
||||
r = SMB_VFS_GET_QUOTA(conn, path, SMB_USER_FS_QUOTA_TYPE, id, &D);
|
||||
if (r == -1 && errno != ENOSYS) {
|
||||
goto try_group_quota;
|
||||
}
|
||||
if (r == 0 && (D.qflags & QUOTAS_DENY_DISK) == 0) {
|
||||
goto try_group_quota;
|
||||
}
|
||||
|
||||
ZERO_STRUCT(D);
|
||||
id.uid = geteuid();
|
||||
|
||||
r = SMB_VFS_GET_QUOTA(conn, path, SMB_USER_QUOTA_TYPE, id, &D);
|
||||
|
||||
/* Use softlimit to determine disk space, except when it has been exceeded */
|
||||
@ -528,6 +543,21 @@ bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
|
||||
return True;
|
||||
|
||||
try_group_quota:
|
||||
/*
|
||||
* First of all, check whether group quota is
|
||||
* enforced. If the call fails, assume it is
|
||||
* not enforced.
|
||||
*/
|
||||
ZERO_STRUCT(D);
|
||||
id.gid = -1;
|
||||
r = SMB_VFS_GET_QUOTA(conn, path, SMB_GROUP_FS_QUOTA_TYPE, id, &D);
|
||||
if (r == -1 && errno != ENOSYS) {
|
||||
return false;
|
||||
}
|
||||
if (r == 0 && (D.qflags & QUOTAS_DENY_DISK) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
id.gid = getegid();
|
||||
|
||||
ZERO_STRUCT(D);
|
||||
|
Loading…
Reference in New Issue
Block a user