mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
smbd: show correct disk size for different quota and dfree block sizes
When file system stats (VFS disk_free_fn) and quota (VFS get_quota_fn) return different block sizes, normalize values before comparing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11681 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 67c89715d00abc588239d8220f09cf51a58db05a)
This commit is contained in:
parent
67db3036a0
commit
830f003c86
@ -123,7 +123,14 @@ uint64_t sys_disk_free(connection_struct *conn, const char *path,
|
||||
}
|
||||
|
||||
if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) {
|
||||
(*bsize) = bsize_q;
|
||||
uint64_t min_bsize = MIN(*bsize, bsize_q);
|
||||
|
||||
(*dfree) = (*dfree) * (*bsize) / min_bsize;
|
||||
(*dsize) = (*dsize) * (*bsize) / min_bsize;
|
||||
dfree_q = dfree_q * bsize_q / min_bsize;
|
||||
dsize_q = dsize_q * bsize_q / min_bsize;
|
||||
|
||||
(*bsize) = min_bsize;
|
||||
(*dfree) = MIN(*dfree,dfree_q);
|
||||
(*dsize) = MIN(*dsize,dsize_q);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user