Other 11.1-RELEASE-p1: NFS quotas not working.

I've newly installed a test system on our network, got NFS client, NIS client and autofs working fully but when I mount a disk from our Solaris 10 server and check the quota I get zeros.

rpc.rquotad is running and all other Solaris and Linux systems on the network can see the quota.

e.g.
FreeBSD system:
Code:
% quota -v
Disk quotas for user steve (uid xxxx):
Filesystem        usage    quota   limit   grace  files   quota  limit   grace
/home/users           0        0       0              0       0      0       
% df -h /home/users
Filesystem            Size    Used   Avail Capacity  Mounted on
nfsserver:/disks/users    3.2T    2.0T    1.2T    62%    /home/users

Solaris 10 system:
Code:
% quota -v
Disk quotas for steve (uid xxxx):
Filesystem     usage  quota  limit    timeleft  files  quota  limit    timeleft
/home/users  18318316 31457280 31457280                  0      0      0           
% df /home/users
Filesystem            kbytes    used   avail capacity  Mounted on
nfsserver:/disks/users   3409584700 2100304048 1309280651    62%    /home/users

As far as I can tell quotas are turned on in the kernel and quota_enable="YES" is in /etc/rc.conf

Any ideas?
 
Found the problem to be in /usr/src/usr.bin/quota.c

The calculations are incorrect for NFS quotas. It will always underflow to zero.

Here's a patch:
Code:
--- quota.c.orig        2017-08-21 17:29:51.322721000 +0100
+++ quota.c     2017-08-21 17:29:01.921212000 +0100
@@ -619,14 +619,14 @@
                gettimeofday(&tv, NULL);
                        /* blocks*/
                dqp->dqb_bhardlimit =
-                   gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit *
-                   (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE);
+                   gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit /
+                   (DEV_BSIZE / gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize);
                dqp->dqb_bsoftlimit =
-                   gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit *
-                   (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE);
+                   gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit /
+                   (DEV_BSIZE / gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize);
                dqp->dqb_curblocks =
-                   gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks *
-                   (gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE);
+                   gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks /
+                   (DEV_BSIZE / gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize);
                        /* inodes */
                dqp->dqb_ihardlimit =
                        gq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit;
 
Back
Top