NFS quotas panic when NFS server has no rquotad

Michael Gerdts Michael.Gerdts at usa.alcatel.com
Fri Apr 27 15:27:15 GMT 2001


I posted the following bug report to samba at samba.org earlier this week:

   Samba 2.2.0 on SPARC Solaris 8
   
   Configured with:
   
   ./configure --with-pam --with-syslog --with-quotas --with-msdfs \
   	--with-acl-support

   I am accessing the share \\server\mgerdts, which is itself an automounted
   (NFS) directory.  That is, /home/mgerdts on server really exists on
   nfsserver.  On nfsserver, rquotad is commented out of inetd.conf.

   (more details deleted)

Please disregard the patch that I sent to the samba at samba.org list.  I
don't like its behavior.

The problem seems to be that at quotas.c:341 clnt_create can return NULL.
If quotastat is then 0 (RPC failed) or 3 (perm denied), a fake limit and
usage of 1 block is assigned, and the nfs_quotas() continues.  At line 398,
clnt is derefenced, causing a SEGV (if quotastat is 0).  

In an environment where quotas are used on some servers but not on others,
this is kinda broken.  What I would like to happen is to have it return
quota information if rquotad responds and gives good information, else
return file system free space.  It appears as though the first attached
patch does that.  The second patch (I think) is cleaner code but has more
lines of patch.

Any chance of getting one of these committed?

Mike
-------------- next part --------------
Index: quotas.c
===================================================================
RCS file: /cvsroot/samba/source/smbd/quotas.c,v
retrieving revision 1.34.4.6
diff -r1.34.4.6 quotas.c
356a357,362
> 	if (quotastat == 0) {
> 		DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
> 		free(cutstr);
> 		return(False);
> 	}
> 
364c370
< 	if (quotastat == 0 || quotastat == 3) {
---
> 	if (quotastat == 3) {
-------------- next part --------------
Index: quotas.c
===================================================================
RCS file: /cvsroot/samba/source/smbd/quotas.c,v
retrieving revision 1.34.4.6
diff -r1.34.4.6 quotas.c
357,362c357,361
< 	if (quotastat == 1) {
< 		DEBUG(9,("nfs_quotas: Good quota data\n"));
< 		D.dqb_bsoftlimit = gqr.getquota_rslt_u.gqr_rquota.rq_bsoftlimit;
< 		D.dqb_bhardlimit = gqr.getquota_rslt_u.gqr_rquota.rq_bhardlimit;
< 		D.dqb_curblocks = gqr.getquota_rslt_u.gqr_rquota.rq_curblocks;
< 	}
---
> 	switch ( quotastat ) {
> 		case 0:
> 			DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
> 			free(cutstr);
> 			return(False);
364,368c363,384
< 	if (quotastat == 0 || quotastat == 3) {
< 		D.dqb_bsoftlimit = 1;
< 		D.dqb_curblocks = 1;
< 		DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
< 	}
---
> 		case 1:
> 			DEBUG(9,("nfs_quotas: Good quota data\n"));
> 			D.dqb_bsoftlimit = gqr.getquota_rslt_u.gqr_rquota.rq_bsoftlimit;
> 			D.dqb_bhardlimit = gqr.getquota_rslt_u.gqr_rquota.rq_bhardlimit;
> 			D.dqb_curblocks = gqr.getquota_rslt_u.gqr_rquota.rq_curblocks;
> 			break;
> 
> 		case 2:
> 			DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
> 			auth_destroy(clnt->cl_auth);
> 			clnt_destroy(clnt);
> 			free(cutstr);
> 			return(False);
> 
> 		case 3:
> 			D.dqb_bsoftlimit = 1;
> 			D.dqb_curblocks = 1;
> 			DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
> 			break;
> 
> 		default:
> 			DEBUG(9,("nfs_quotas: Remote Quotas Questionable!  Error \"%i\" \n", quotastat ));
370,375d385
< 	if (quotastat == 2) {
< 		DEBUG(9,("nfs_quotas: Remote Quotas Failed!  Error \"%i\" \n", quotastat ));
< 		auth_destroy(clnt->cl_auth);
< 		clnt_destroy(clnt);
< 		free(cutstr);
< 		return(False);


More information about the samba-technical mailing list