Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 May 2008 20:15:40 GMT
From:      Adam McDougall <mcdouga9@egr.msu.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/124172: Samba disk quota support uses hardcoded and wrong blocksize for calculation
Message-ID:  <200805312015.m4VKFe2K011909@www.freebsd.org>
Resent-Message-ID: <200805312020.m4VKK30n038672@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         124172
>Category:       ports
>Synopsis:       Samba disk quota support uses hardcoded and wrong blocksize for calculation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 31 20:20:03 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Adam McDougall
>Release:        6.3-STABLE
>Organization:
>Environment:
FreeBSD ghost 6.3-STABLE FreeBSD 6.3-STABLE #4: Thu Feb 14 12:53:43 EST 2008     Rmcdouga@ghost:/usr/obj/usr/src/sys/X4100  amd64

>Description:
For a year or two at least, Samba has native support for NFS quotas on FreeBSD, but appears to make assumptions about the NFS server blocksize leading it to false reporting of quota usage and capacity.  I traced it down to this section of code, which I patch locally with another hack because it is simple enough to work for our site.  Basically, DEV_BSIZE is defined in a local system header as 512, which doesn't match a Netapp's blocksize of 4096, so all quotas are reported as 1/8th the real size.  Maybe FreeBSD NFS servers use a 512 blocksize, but the only servers I have quota enabled on use 4096 so I hardcoded it.  I would believe the proper thing to do would be to issue an RPC call to the server of the current mountpoint requesting the blocksize from the server. Additionally, the validity of the if check just before it looks questionable, it appears to be doing the equivalent of if (A == A == 1).  It looked like the block of code for quotas on FreeBSD was cut and pasted fro
 m another platform in the same file and modified to suit FreeBSD.  

--- smbd/quotas.c       Thu Jan 11 12:13:31 2007
+++ smbd/quotas.c       Thu Jan 11 12:26:42 2007
@@ -1091,7 +1091,15 @@
        *dsize = D.dqb_bsoftlimit;

        if (D.dqb_curblocks == D.dqb_curblocks == 1)
-               *bsize = DEV_BSIZE;
+       /*      *bsize = DEV_BSIZE; /*
+               *bsize = 4096;

>How-To-Repeat:
Compile samba with QUOTAS support on FreeBSD.  Create a samba share in smb.conf pointing to an NFS mount with a user quota applied and a non-512 blocksize such as a NetApp which uses 4096.  Use standard methods of checking the samba share's usage and free space totals (such as right clicking the drive letter in windows and clicking Properties) and note the disparity between reported values and real values. 

>Fix:
*bsize should be set to the NFS server's reported blocksize, not a static number.  

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805312015.m4VKFe2K011909>