summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2004-05-24 19:39:15 +0000
committerjkar8572 <jkar8572>2004-05-24 19:39:15 +0000
commite1200421607be898a9c56618948c3f5e4e00781e (patch)
tree0d5c6787f879b8cd79c324683bdde037d26ac2b5
parent06ac151a68c668a8c4cee8a2a377b0ae93b99fb1 (diff)
Updated version to 3.12
Fixed a few memleaks Added two manpages Fixed problem with all-zero root structure
-rw-r--r--Changelog4
-rw-r--r--Makefile.in2
-rw-r--r--quotacheck_v2.c7
-rw-r--r--quotaio.c2
-rw-r--r--quotaio_v1.c7
-rw-r--r--quotaio_v2.c9
-rw-r--r--quotaon.c5
-rw-r--r--quotaops.c15
-rw-r--r--quotastats.841
-rw-r--r--rquota_server.c8
-rw-r--r--warnquota.c4
-rw-r--r--xqmstats.838
12 files changed, 126 insertions, 16 deletions
diff --git a/Changelog b/Changelog
index 23894e9..06ca45d 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,8 @@
Changes in quota-tools from 3.11 to 3.12
+* fixed bug in quotaon(8) reporting (Paul Szabo)
+* added manpages for xqmstats & quotastats (Max Vozeler)
+* fixed a few memleaks (Jan Kara)
+* fixed bug when root had no usage and limits (Jan Kara)
* added a few perl wrappers for LDAP (Stefan Adams)
* added note about availability of -r option to manpages (Jan Kara)
* maximal number of groups is now got via sysconf (Nathan Scott)
diff --git a/Makefile.in b/Makefile.in
index 8c1dd45..639367e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
PROGS = quotacheck quotaon quota quot repquota warnquota quotastats xqmstats edquota setquota convertquota rpc.rquotad
SOURCES = bylabel.c common.c convertquota.c edquota.c pot.c quot.c quota.c quotacheck.c quotacheck_v1.c quotacheck_v2.c quotaio.c quotaio_rpc.c quotaio_v1.c quotaio_v2.c quotaio_xfs.c quotaio_generic.c quotaon.c quotaon_xfs.c quotaops.c quotastats.c quotasys.c repquota.c rquota_client.c rquota_server.c rquota_svc.c setquota.c warnquota.c xqmstats.c svc_socket.c
-VERSIONDEF = -DQUOTA_VERSION=\"3.11\"
+VERSIONDEF = -DQUOTA_VERSION=\"3.12\"
CFLAGS = @CFLAGS@ @EXT2_DIRECT@ -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(VERSIONDEF)
EXT2LIBS = @EXT2LIBS@
RPCSRC = rquota.h rquota_xdr.c rquota_clnt.c
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
index 6ede24e..494f957 100644
--- a/quotacheck_v2.c
+++ b/quotacheck_v2.c
@@ -198,8 +198,11 @@ static int buffer_entry(dqbuf_t buf, uint blk, int *corrupted, uint * lblk, int
fdq->dqb_bsoftlimit = mdq.dqb_bsoftlimit;
fdq->dqb_ihardlimit = mdq.dqb_ihardlimit;
fdq->dqb_isoftlimit = mdq.dqb_isoftlimit;
- fdq->dqb_btime = mdq.dqb_btime;
- fdq->dqb_itime = mdq.dqb_itime;
+ /* Add grace times only if there are limits... */
+ if (mdq.dqb_bsoftlimit)
+ fdq->dqb_btime = mdq.dqb_btime;
+ if (mdq.dqb_isoftlimit)
+ fdq->dqb_itime = mdq.dqb_itime;
}
return 0;
}
diff --git a/quotaio.c b/quotaio.c
index c08406f..77d60b5 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -115,6 +115,8 @@ struct quota_handle *init_io(struct mntent *mnt, int type, int fmt, int flags)
h->qh_fd = -1;
h->qh_fmt = fmt;
}
+ free(qfname); /* We don't need it anymore */
+ qfname = NULL;
if (h->qh_fmt == QF_VFSOLD)
h->qh_ops = &quotafile_ops_1;
diff --git a/quotaio_v1.c b/quotaio_v1.c
index 40b2ad0..d61546e 100644
--- a/quotaio_v1.c
+++ b/quotaio_v1.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaio_v1.c,v 1.13 2002/11/21 18:37:58 jkar8572 Exp $"
+#ident "$Id: quotaio_v1.c,v 1.14 2004/05/24 19:39:15 jkar8572 Exp $"
#include <unistd.h>
#include <errno.h>
@@ -381,8 +381,11 @@ static int v1_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct d
return rd;
}
}
- if (!rd) /* EOF? */
+ if (!rd) { /* EOF? */
+ free(dquot);
return 0;
+ }
out_err:
+ free(dquot);
return -1; /* Some read errstr... */
}
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 095c39c..47e0cdc 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -662,6 +662,11 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id)
strerror(errno));
}
v2_disk2memdqblk(&dquot->dq_dqb, &ddquot);
+ /* Unescape all-zero structure (it can be on disk after a crash) */
+ if (!dquot->dq_id && !dquot->dq_dqb.dqb_bhardlimit && !dquot->dq_dqb.dqb_bsoftlimit &&
+ !dquot->dq_dqb.dqb_curspace && !dquot->dq_dqb.dqb_ihardlimit && !dquot->dq_dqb.dqb_isoftlimit &&
+ !dquot->dq_dqb.dqb_curinodes && !dquot->dq_dqb.dqb_btime && dquot->dq_dqb.dqb_itime == 1)
+ dquot->dq_dqb.dqb_itime = 0;
}
return dquot;
}
@@ -791,8 +796,10 @@ static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct d
die(4, _("Can't sync quotas on device %s: %s\n"), h->qh_quotadev,
strerror(errno));
lseek(h->qh_fd, V2_DQINFOOFF, SEEK_SET);
- if (read(h->qh_fd, &ddqinfo, sizeof(ddqinfo)) != sizeof(ddqinfo))
+ if (read(h->qh_fd, &ddqinfo, sizeof(ddqinfo)) != sizeof(ddqinfo)) {
+ free(dquot);
return -1;
+ }
info->dqi_blocks = __le32_to_cpu(ddqinfo.dqi_blocks);
dquot->dq_h = h;
bitmap = smalloc((info->dqi_blocks + 7) >> 3);
diff --git a/quotaon.c b/quotaon.c
index 78c5414..7710b58 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaon.c,v 1.17 2003/07/15 22:40:34 jkar8572 Exp $"
+#ident "$Id: quotaon.c,v 1.18 2004/05/24 19:39:15 jkar8572 Exp $"
/*
* Turn quota on/off for a filesystem.
@@ -172,6 +172,9 @@ static int print_state(struct mntent *mnt, int type)
if (kernel_formats & (1 << QF_XFS))
on = kern_quota_on(mnt->mnt_fsname, type, 1 << QF_XFS) != -1;
}
+ else if (kernel_iface == IFACE_GENERIC)
+ /* PSz 28 Apr 04 Have V0 and OLD set, try both */
+ on = kern_quota_on(mnt->mnt_fsname, type, kernel_formats) != -1;
else if (kernel_formats & (1 << QF_VFSV0))
on = kern_quota_on(mnt->mnt_fsname, type, 1 << QF_VFSV0) != -1;
else if (kernel_formats & (1 << QF_VFSOLD))
diff --git a/quotaops.c b/quotaops.c
index b2595ba..68e03d5 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaops.c,v 1.13 2004/04/20 19:33:05 jkar8572 Exp $"
+#ident "$Id: quotaops.c,v 1.14 2004/05/24 19:39:15 jkar8572 Exp $"
#include <rpc/rpc.h>
#include <sys/types.h>
@@ -112,6 +112,8 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
}
break;
case GRPQUOTA:
+ if (geteuid() == 0)
+ break;
ngroups = sysconf(_SC_NGROUPS_MAX);
if (ngroups > NGROUPS) {
gidsetp = malloc(ngroups * sizeof(gid_t));
@@ -119,11 +121,13 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
errstr(_("%s: gid set allocation (%d): %s\n"), name, ngroups, strerror(errno));
return (struct dquot *)NULL;
}
- } else {
- gidsetp = &gidset[0];
}
+ else
+ gidsetp = &gidset[0];
ngroups = getgroups(ngroups, gidsetp);
if (ngroups < 0) {
+ if (gidsetp != gidset)
+ free(gidsetp);
errstr(_("%s: error while trying getgroups(): %s\n"), name, strerror(errno));
return (struct dquot *)NULL;
}
@@ -131,8 +135,9 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
for (j = 0; j < ngroups; j++)
if (id == gidsetp[j])
break;
-
- if (j >= ngroups && geteuid() != 0) {
+ if (gidsetp != gidset)
+ free(gidsetp);
+ if (j >= ngroups) {
gid2group(id, name);
errstr(_("%s (gid %d): Permission denied\n"),
name, id);
diff --git a/quotastats.8 b/quotastats.8
new file mode 100644
index 0000000..6ebfccf
--- /dev/null
+++ b/quotastats.8
@@ -0,0 +1,41 @@
+.\" 2004, Max Vozeler <max@hinterhof.net>
+.\" Released under the Gnu GPL
+.TH QUOTASTATS 8 "April 2, 2004" "" "quota"
+.SH NAME
+.B quotastats
+\- Program to query quota statistics
+.SH SYNOPSIS
+.I /usr/sbin/quotastats
+.SH DESCRIPTION
+.B quotastats
+queries the kernel for quota statistics.
+It displays:
+.P
+.PD 0
+.RS 4
+.IP \[bu]
+Supported kernel quota version
+.IP \[bu]
+Number of dquot lookups
+.IP \[bu]
+Number of dquot drops
+.IP \[bu]
+Number of dquot reads
+.IP \[bu]
+Number of dquot writes
+.IP \[bu]
+Number of quotafile syncs
+.IP \[bu]
+Number of dquot cache hits
+.IP \[bu]
+Number of allocated dquots
+.IP \[bu]
+Number of free dquots
+.IP \[bu]
+Number of in use dquot entries (user/group)
+.RE
+.PD
+.SH OPTIONS
+None.
+.SH SEE ALSO
+.BR quota (1).
diff --git a/rquota_server.c b/rquota_server.c
index 3f2a6fd..2c0f366 100644
--- a/rquota_server.c
+++ b/rquota_server.c
@@ -9,7 +9,7 @@
*
* This part does the lookup of the info.
*
- * Version: $Id: rquota_server.c,v 1.14 2003/12/02 13:04:20 jkar8572 Exp $
+ * Version: $Id: rquota_server.c,v 1.15 2004/05/24 19:39:15 jkar8572 Exp $
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
@@ -187,8 +187,11 @@ setquota_rslt *setquotainfo(int flags, caddr_t * argp, struct svc_req *rqstp)
dquot->dq_dqb.dqb_curspace = dqblk.dqb_curspace;
dquot->dq_dqb.dqb_curinodes = dqblk.dqb_curinodes;
}
- if (handles[0]->qh_ops->commit_dquot(dquot, COMMIT_LIMITS) == -1)
+ if (handles[0]->qh_ops->commit_dquot(dquot, COMMIT_LIMITS) == -1) {
+ free(dquot);
goto out;
+ }
+ free(dquot);
result.status = Q_OK;
out:
dispose_handle_list(handles);
@@ -264,6 +267,7 @@ getquota_rslt *getquotainfo(int flags, caddr_t * argp, struct svc_req * rqstp)
result.getquota_rslt_u.gqr_rquota.rq_active =
QIO_ENABLED(handles[0]) ? TRUE : FALSE;
servutil2netdqblk(&result.getquota_rslt_u.gqr_rquota, &dquot->dq_dqb);
+ free(dquot);
}
out:
dispose_handle_list(handles);
diff --git a/warnquota.c b/warnquota.c
index bc4eacb..9eefa89 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -10,7 +10,7 @@
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
- * Version: $Id: warnquota.c,v 1.20 2004/03/12 18:08:52 jkar8572 Exp $
+ * Version: $Id: warnquota.c,v 1.21 2004/05/24 19:39:15 jkar8572 Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -566,7 +566,7 @@ int get_quotatable(void)
}
line = 0;
- for (qtab_i = 0; quotatable = realloc(quotatable, sizeof(quotatable_t) * (qtab_i + 1)),
+ for (qtab_i = 0; quotatable = srealloc(quotatable, sizeof(quotatable_t) * (qtab_i + 1)),
fgets(buffer, sizeof(buffer), fp); qtab_i++) {
line++;
quotatable[qtab_i].devname = NULL;
diff --git a/xqmstats.8 b/xqmstats.8
new file mode 100644
index 0000000..a36a138
--- /dev/null
+++ b/xqmstats.8
@@ -0,0 +1,38 @@
+.\" 2004, Max Vozeler <max@hinterhof.net>
+.\" Released under the Gnu GPL
+.TH XQMSTATS 8 "April 2, 2004" "" "quota"
+.SH NAME
+.B xqmstats
+\- Display XFS quota manager statistics from /proc
+.SH SYNOPSIS
+.I /usr/sbin/xqmstats
+.SH DESCRIPTION
+.B xqmstat
+queries the kernel for the XFS Quota Manager dquot statistics.
+It displays:
+.P
+.PD 0
+.RS 4
+.IP \[bu]
+Reclaims
+.IP \[bu]
+Missed reclaims
+.IP \[bu]
+Dquot dups
+.IP \[bu]
+Cache misses
+.IP \[bu]
+Cache hits
+.IP \[bu]
+Dquot wants
+.IP \[bu]
+Shake reclaims
+.IP \[bu]
+Inact reclaims
+.RE
+.PD
+.SH OPTIONS
+None.
+.SH SEE ALSO
+.BR quotastats (1),
+.BR quota (1).