Bug 42352 - quota doesn't RPC to NFS server
Summary: quota doesn't RPC to NFS server
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: quota
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Steve Dickson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-05-25 22:21 UTC by Zvezdan Petkovic
Modified: 2014-01-21 22:48 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-05-05 03:23:24 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2001:108 0 normal SHIPPED_LIVE Updated quota package for Red Hat Linux 7.1 2001-08-30 04:00:00 UTC

Description Zvezdan Petkovic 2001-05-25 22:21:08 UTC
Description of Problem:

quota-3.00-4.i386.rpm that comes in the default installation of Red Hat 
7.1 was not exchanging RPC messages with the Solaris server from which
a quota controlled disk was mounted. 

How Reproducible:

For example, 
servername:/export/home/d9 is mounted over NFS as /home/d9 on a Linux 
machine using automount [I tried mounting from /etc/fstab too]. The 
results of applying quota is:

[~]> quota
Disk quotas for user zvezdan(uid#): None

`strace quota' shows that it even doesn't try to RPC the server.

Steps to Reproduce:
1. add NFS mount point in /etc/fstab or using automount
2. reboot or restart automount
3. type quota or `strace quota'

Actual Results:

Disk quotas for user zvezdan(uid#): None

Expected Results:

Disk quotas for user zvezdan(uid#): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit  
grace
     servername   45258   60000  66000    none       0       0      0    
none

Additional Information:
 
I fixed the bugs in the original source code for quota, RedHat patch for
quota and quota.spec files.

The bugs in source were:

	* You were passing mnt [local directory, e.g. /home/d9] instead of
	  dev [remote directory, e.g. server:/export/home/d9] to
	  rpc_rquota().

	* You did not include MNTTYPE_NFS in the list of valid FS types
	  for quota checking.

	* You forgot the parenthesis around the macro CORRECT_FSTYPE.
	  Old and simple rule. Didn't want to accept correct fstype until
	  I enclosed it in the set of parens.

The bug in spec file is setting of CFLAGS. The CFLAGS value in Makefile 
depended on the setting for RPC=1 that was also passed from the command 
line to make. Hence, in the make file the CFLAGS would be correctly 
evaluated but eventually ignored because they were set on the command 
line too. I replaced this with RPM_CFLAGS and assigned to the initial 
value of CFLAGS in the Makefile $(RPM_CFLAGS).

Here is the patch for source [file quota-3.00-wm.patch]
=================================================
diff -Naur quota-3.00-redhat/Makefile quota-3.00/Makefile
--- quota-3.00-redhat/Makefile  Fri May 25 16:57:04 2001
+++ quota-3.00/Makefile Fri May 25 17:20:24 2001
@@ -18,7 +18,7 @@
 OBJS = quota_io.o quotasys.o common.o setquota.o convertquota.o 
quotadebug.o quotaon.o quota.o repquota.o quotacheck.o edquota.o
 LIBOBJS = quota_io.o quotasys.o common.o bylabel.o
 DIR = quota-3.00
-CFLAGS = -Wall -O2 -g
+CFLAGS = $(RPM_CFLAGS)
 #CFLAGS = -Wall -O2
 ifeq ($(RPC),1)
   CFLAGS += -DRPC
diff -Naur quota-3.00-redhat/quota.c quota-3.00/quota.c
--- quota-3.00-redhat/quota.c   Fri May 25 16:57:04 2001
+++ quota-3.00/quota.c  Fri May 25 16:58:26 2001
@@ -224,7 +224,7 @@
        }
        else {
 #ifdef RPC
-               rpc_rquota(mnt, id, type, &blk);
+               rpc_rquota(dev, id, type, &blk);
 #else
                return;
 #endif
diff -Naur quota-3.00-redhat/quotasys.c quota-3.00/quotasys.c
--- quota-3.00-redhat/quotasys.c        Fri May 25 16:57:04 2001
+++ quota-3.00/quotasys.c       Fri May 25 16:58:26 2001
@@ -22,12 +22,13 @@
 
 #define min(x,y) (((x) < (y)) ? (x) : (y))
 #define CORRECT_FSTYPE(type) \
-(!strcmp(type, MNTTYPE_EXT2)) || \
-(!strcmp(type, MNTTYPE_EXT3)) || \
-(!strcmp(type, MNTTYPE_MINIX)) || \
-(!strcmp(type, MNTTYPE_UFS)) || \
-(!strcmp(type, MNTTYPE_UDF)) || \
-(!strcmp(type, MNTTYPE_REISER))
+((!strcmp(type, MNTTYPE_EXT2)) || \
+ (!strcmp(type, MNTTYPE_EXT3)) || \
+ (!strcmp(type, MNTTYPE_MINIX)) || \
+ (!strcmp(type, MNTTYPE_UFS)) || \
+ (!strcmp(type, MNTTYPE_UDF)) || \
+ (!strcmp(type, MNTTYPE_REISER)) || \
+ (!strcmp(type, MNTTYPE_NFS)))
 
 static char names[MAXQUOTAS + 2][20] = INITQFNAMES;

==========================================================

Here's patch for the spec file.
==========================================================
--- quota.spec.redhat   Fri May 25 17:37:54 2001
+++ quota.spec  Fri May 25 17:26:23 2001
@@ -1,12 +1,13 @@
 Name: quota
 Summary: System administration tools for monitoring users' disk usage.
 Version: 3.00
-Release: 4
+Release: 5
 Serial: 1
 Source0: 
ftp://atrey.karlin.mff.cuni.cz/pub/local/jack/quota/utils/%{name}-3.00-4.tar.gz
 Copyright: BSD
 Group: System Environment/Base
 Patch0: quota-3.00-redhat.patch
+Patch1: quota-3.00-wm.patch
 BuildRoot: %{_tmppath}/%{name}-root
 Requires: kernel >= 2.4
 BuildPreReq: e2fsprogs-devel
@@ -22,9 +23,10 @@
 %setup -q
 
 %patch0 -p1 -b .redhat
+%patch1 -p1 -b .wm
 
 %build
-make CFLAGS="$RPM_OPT_FLAGS" RPC=1 RPC_SERVER=1 ALT_FORMAT=1
+make RPM_CFLAGS="$RPM_OPT_FLAGS" RPC=1 RPC_SERVER=1 ALT_FORMAT=1
 
 %install
 rm -fr %{buildroot}
=====================================================================

Comment 1 Seth Vidal 2001-05-29 16:45:36 UTC
as far as I can tell the patch doesn't work.
I applied both patches and rebuilt and reinstalled the binary.
 I'm still getting no reported quotas. However, rhl 6.2 and 7.0 both report it
correctly. 

After I apply the patch you provided I don't get any rpc attempts either. I can
include the strace if it would be useful to you.

thanks

the nfs server in this case is rhl 6.2




Comment 2 Zvezdan Petkovic 2001-05-29 18:52:25 UTC
Did you have any reports of errors from the patch utility?
I notice that a few lines above are broken by bugzilla entry forms.
However it's not difficult to find these files and a few lines that are 
patched, compile, and try. It is extremely important to change the SPEC file.
It prevents make from using -DRPC while compiling.

If you don't feel like doing that I have posted the patches and rpms at 
http://www.cs.wm.edu/~zvezdan/programs/patches/ for the convenience.

Comment 3 Seth Vidal 2001-05-29 19:07:32 UTC
I fixed the problems with bugzilla reformatting and both patches applied cleanly.


I also just downloaded and compiled your srpm to check that I didn't screw up
the patch in some obscure way. Still no joy. I get no listed quotas.

I'm stepping through it in ddd now, I'll let you know what I find out.

thanks


Comment 4 Zvezdan Petkovic 2001-05-29 20:14:43 UTC
Well, after this fix quota works fine in my environment (Linux workstations 
mounting from Solaris servers using automount). Do you have any other NFS rpc 
troubles unrelated to quota (e.g. locking)? For example, portmap is run as 
user rpc and rpc.statd must be run as user rpcuser (instead of superuser). 
Check your log messages. I ensured that all other NFS things are running 
smoothly before testing quota. Once I tracked the bugs and fixed them 
everything works as a charm.

The only thing that bothers me is that the original quota binary couldn't work 
with anything but ext2 file systems due to the bug in the macro shown above. 
It especially couldn't work with NFS because somebody who made that Red Hat 
patch thinks its not a valid filesystem for quota (sic!). I wonder if anybody 
in Red Hat tested this with anything else except local ext2 partitions?

Comment 5 Seth Vidal 2001-05-29 20:46:17 UTC
I've checked and rechecked the mounting and from other systems.

I have about 130 red hat linux 6.2 boxes (mostly 2.2.19-6.2.1) with quota 2.00
mounting a rhl 6.2 server (2.2.17) running rquotad from quota 2.00(pre3)


quotas work just fine from the 6.2 and the one 7.0 box I have. And they are
making rpc calls (I checked this in strace). On 7.1 no rpc calls - and I stepped
through it in gdb and it appears that they don't even determine that the disks
are nfs mounted at all.

I agree though, this was clearly never tested on nfs. 



Comment 6 Seth Vidal 2001-06-07 14:33:50 UTC
I've tested this using rh 7.1 client and server now. I've used both nfsv2 and v3
for the mount and I've verified that rquotad is running and working on the
server by mounting and testing from a rhl 6.2 box and checking the quotas.

The patch provided above does not seem to detect that the nfs mount is an nfs
mount at all.

zvevzdan - can you check it on your end mounting a linux server and see if you
can see where the problem is?

I'll see what I can come up with.


Comment 7 Anders Blomdell 2001-06-07 16:27:53 UTC
The handling of grace-time over the net also seems to be broken, the absolute 
limit is what gets transferred via the RPC, but it should be the number of 
seconds left that should be transferred. Here's a patch:

--- ../quota-3.00.orig/quota.c  Thu Jun  7 18:21:06 2001
+++ ./quota.c   Thu Jun  7 18:07:08 2001
@@ -112,14 +112,25 @@
 /* Convert network format to our format */
 void rquota2dqblk(struct mem_dqblk *dqb, rquota *rq)
 {
+       time_t now;
+
+       time(&now);
        dqb->dqb_bhardlimit = rq->rq_bhardlimit;
        dqb->dqb_bsoftlimit = rq->rq_bsoftlimit;
        dqb->dqb_curspace = rq->rq_curblocks << QUOTABLOCK_BITS;
        dqb->dqb_ihardlimit = rq->rq_fhardlimit;
        dqb->dqb_isoftlimit = rq->rq_fsoftlimit;
        dqb->dqb_curinodes = rq->rq_curfiles;
-       dqb->dqb_btime = rq->rq_btimeleft;
-       dqb->dqb_itime = rq->rq_ftimeleft;
+       if (rq->rq_btimeleft) {
+         dqb->dqb_btime = rq->rq_btimeleft + now;
+       } else {
+         dqb->dqb_btime = 0;
+       }
+       if (dqb->dqb_itime) {
+         dqb->dqb_itime = rq->rq_ftimeleft + now;
+       } else {
+         dqb->dqb_itime = 0;
+       }
 }
 
 /*


--- ../quota-3.00.orig/rquota_server.c  Thu Jun  7 18:21:07 2001
+++ ./rquota_server.c   Thu Jun  7 18:18:54 2001
@@ -70,14 +70,25 @@
 
 static void dqblk2rquota(rquota *rq, struct mem_dqblk *dqb)
 {
+       time_t now;
+
+       time(&now);
        rq->rq_bhardlimit = dqb->dqb_bhardlimit;
        rq->rq_bsoftlimit = dqb->dqb_bsoftlimit;
        rq->rq_curblocks = toqb(dqb->dqb_curspace);
        rq->rq_fhardlimit = dqb->dqb_ihardlimit;
        rq->rq_fsoftlimit = dqb->dqb_isoftlimit;
        rq->rq_curfiles = dqb->dqb_curinodes;
-       rq->rq_btimeleft = dqb->dqb_btime;
-       rq->rq_ftimeleft = dqb->dqb_itime;
+       if (dqb->dqb_btime) {
+         rq->rq_btimeleft = dqb->dqb_btime - now;
+       } else {
+         rq->rq_btimeleft = 0;
+       }
+       if (rq->rq_ftimeleft) {
+         rq->rq_ftimeleft = dqb->dqb_itime - now;
+       } else {
+         rq->rq_ftimeleft = 0;
+       }
 }
 
 static getquota_rslt *getquotainfo(int flags, caddr_t *argp, struct svc_req *
rqstp)


Comment 8 Seth Vidal 2001-06-13 15:32:55 UTC
I built a new rpm based on quota-3.01pre7 from the linux-quota folks (housed at
sourceforge) this release (with one patch for the rpc_quota size divisor) fixes
the problems I had.

go here to grab the srpm:
http://www.dulug.duke.edu/~skvidal/misc/quota/quota-3.01pre7-2.src.rpm

if someone has a solaris nfs/quota server and could test it I would appreciate it.



Comment 9 Need Real Name 2001-06-22 18:59:38 UTC
I've tested your patched version of quota on a RedHat 7.1 client (2.4.2-2) with
NFS mounts from Solaris file servers (5.7 && SunOS 4.1.4). It is now
communicating properly and displaying the correct quotas.

Comment 10 Seth Vidal 2001-06-22 23:46:52 UTC
On addendum - the quota-rpc.patch that I applied to the stock quota-3.01pre7 is
not necessary. That patch only corrects a problem if you were using the
rpc.rquotad that came with nfs-utils.

Comment 11 Preston Brown 2001-07-20 17:49:49 UTC
Would you like to beta test some new quota RPMs?  They are available at:

http://people.redhat.com/pbrown/quota-3.01pre8-1.i386.rpm

I would appreciate your feedback on this package.


Comment 12 Zvezdan Petkovic 2001-08-01 19:43:59 UTC
I tested quota-3.01pre8-1.i386.rpm and it works fine in my environment:
Linux workstation mounting quota enabled file systems from a Solaris server.

Here's output:

Disk quotas for user zvezdan (uid <number here>): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
<servername>:/export/home/<servername>9
                  26369   30000   33000            1940       0       0        

One thing I didn't like though is that there are file conflicts with 
glibc-devel. I deinstalled rpm and put back my patched version and original
glibc-devel back. I expect an official update eagerly.

Comment 13 Anders Blomdell 2001-08-14 11:43:49 UTC
Seems to work OK. I'll put it into production use as soon as the diffs between 
quota-3.01pre8-1 and quota-3.01pre8 are made public.


Comment 14 Anders Blomdell 2001-08-14 12:06:58 UTC
OOPS, talking too quickly. quotaon doesn't work. 
	
  ./quotaon -v /dev/hda6
  quotaon: using /export/work2/quota.user on /dev/hda6: No such file or directory

should be using aquota.user, since that is what quotacheck generates...

The original (RedHat) 7.1 quotaon does:

quotaon -v /dev/hda6
Turning user quotas on for device /dev/hda6 (/export/work2)...done



Comment 15 Raymond 2001-08-22 18:00:08 UTC
For quota-3.01pre8-1.i386.rpm, I create a link from quota.user to aquota.user.
It seems OK.

Comment 16 Preston Brown 2001-08-30 14:50:38 UTC
OK, this is being fixed.


Comment 17 Jairo Rizzo 2001-11-17 11:25:16 UTC
Hi,
 Even by updating to quota-3.01pre9-0.7.1 I still have the following problems.

1. I can see the groups coming from NIS
2. I can set limits to these groups
3. Limits are not enforced to NIS groups
4. Info for quota for these groups show as 0 (file size, file count).
5. I can set limits to NIS users and limit enforcement works.

My fstab entry for the partition is:
/dev/sdb1       /extra  ext2     exec,dev,suid,rw,usrquota,grpquota 1 3

I'm using
quota-3.01pre9-0.7.1

Notes:
[root@xxx /extra]# quota -g nisgroup
Disk quotas for group nisgroup (gid 600): none


Thanks for the help.

-rizzo

Comment 18 Andreas Metzler 2002-09-23 09:58:15 UTC
This seems to be a duplicate off #34472 which I cannot reproduce on RedHat 7.3.
The issue nevertheless remains because now the server-side is completely broken,
see #73608. Sigh.
               cu andreas

Comment 19 Petri T. Koistinen 2003-05-17 22:14:00 UTC
See also new bug #90939.

Comment 20 Seth Vidal 2004-05-05 03:23:24 UTC
I've not seen this bug in quota in about a year now.
Closing as currentrelease. If it's still a problem on a supported
release then reopen it.




Note You need to log in before you can comment on or make changes to this bug.