4.00 bump

This commit is contained in:
Petr Písař 2011-08-23 15:20:03 +02:00
parent 94cfbfb16c
commit 4b1641c353
30 changed files with 78 additions and 1930 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
quota-3.17.tar.gz
/quota-4.00-pre1.tar.gz
/quota-4.00.tar.gz

View File

@ -1,58 +0,0 @@
diff -urNp quota-tools-orig/edquota.c quota-tools/edquota.c
--- quota-tools-orig/edquota.c 2008-08-05 13:37:34.000000000 +0200
+++ quota-tools/edquota.c 2008-08-05 13:46:42.000000000 +0200
@@ -130,9 +130,9 @@ int parse_options(int argc, char **argv)
quotatype = USRQUOTA;
#if defined(RPC_SETQUOTA)
- while ((ret = getopt_long(argc, argv, "ugrmntTVp:F:f:", long_opts, NULL)) != -1) {
+ while ((ret = getopt_long(argc, argv, "ughrmntTVp:F:f:", long_opts, NULL)) != -1) {
#else
- while ((ret = getopt_long(argc, argv, "ugtTVp:F:f:", long_opts, NULL)) != -1) {
+ while ((ret = getopt_long(argc, argv, "ughtTVp:F:f:", long_opts, NULL)) != -1) {
#endif
switch (ret) {
case 'p':
@@ -172,6 +172,7 @@ int parse_options(int argc, char **argv)
case 'V':
version();
exit(0);
+ case 'h':
default:
usage();
}
diff -urNp quota-tools-orig/quota.c quota-tools/quota.c
--- quota-tools-orig/quota.c 2008-08-05 13:37:34.000000000 +0200
+++ quota-tools/quota.c 2008-08-05 13:41:45.000000000 +0200
@@ -270,7 +270,7 @@ int main(int argc, char **argv)
gettexton();
progname = basename(argv[0]);
- while ((ret = getopt_long(argc, argv, "guqvsVliQF:wfApm", long_opts, NULL)) != -1) {
+ while ((ret = getopt_long(argc, argv, "ghuqvsVliQF:wfApm", long_opts, NULL)) != -1) {
switch (ret) {
case 'g':
flags |= FL_GROUP;
@@ -321,6 +321,7 @@ int main(int argc, char **argv)
case 'V':
version();
exit(0);
+ case 'h':
default:
usage();
}
diff -urNp quota-tools-orig/setquota.c quota-tools/setquota.c
--- quota-tools-orig/setquota.c 2008-08-05 13:37:34.000000000 +0200
+++ quota-tools/setquota.c 2008-08-05 13:45:48.000000000 +0200
@@ -107,9 +107,9 @@ static void parse_options(int argcnt, ch
char *protoname = NULL;
#ifdef RPC_SETQUOTA
- char *opts = "gp:urmVF:taTbc";
+ char *opts = "ghp:urmVF:taTbc";
#else
- char *opts = "gp:uVF:taTbc";
+ char *opts = "ghp:uVF:taTbc";
#endif
struct option long_opts[] = {
{ "user", 0, NULL, 'u' },

View File

@ -1,22 +0,0 @@
diff -urNp quota-tools-orig/quotaon.c quota-tools/quotaon.c
--- quota-tools-orig/quotaon.c 2008-03-13 15:49:33.000000000 +0100
+++ quota-tools/quotaon.c 2008-11-14 13:05:53.000000000 +0100
@@ -66,7 +66,7 @@ static void usage(void)
{
errstr(_("Usage:\n\t%s [-guvp] [-F quotaformat] [-x state] -a\n\
\t%s [-guvp] [-F quotaformat] [-x state] filesys ...\n\n\
--a, --all turn quotas on for all filesystems\n\
+-a, --all turn quotas %s for all filesystems\n\
-f, --off turn quotas off\n\
-u, --user operate on user quotas\n\
-g, --group operate on group quotas\n\
@@ -75,7 +75,8 @@ static void usage(void)
-F, --format=formatname operate on specific quota format\n\
-v, --verbose print more messages\n\
-h, --help display this help text and exit\n\
--V, --version display version information and exit\n"), progname, progname);
+-V, --version display version information and exit\n"),
+ progname, progname, strcmp (progname, "quotaon")?_("off"):_("on"));
exit(1);
}

View File

@ -1,6 +1,6 @@
From 85cb5b094c8e6a352df4c5bdbbfd6af4c47a7ae7 Mon Sep 17 00:00:00 2001
From c00ee2d477c3f464d81c6ec597b409829aa2b5f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 28 Feb 2011 14:16:59 +0100
Date: Tue, 23 Aug 2011 14:50:30 +0200
Subject: [PATCH] Do not use real domains in warnquota example
Providing private domain names in default warnquota.conf can tend
@ -10,14 +10,14 @@ some users to reply. Owners of that domain could get mad.
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/warnquota.conf b/warnquota.conf
index 153b3f2..e70eedf 100644
index bc95e2c..e70eedf 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -5,15 +5,15 @@
# values can be quoted:
MAIL_CMD = "/usr/sbin/sendmail -t"
-FROM =
-FROM =
+FROM = root@example.com
# but they don't have to be:
SUBJECT = NOTE: You are exceeding your allocated disk space limits
@ -42,5 +42,5 @@ index 153b3f2..e70eedf 100644
GROUP_MESSAGE = Hello, a group '%i' you're member of use too much space at %h.|\
I chose you to do the cleanup.|Delete group files on the following filesystems:|
--
1.7.4
1.7.6

View File

@ -1,6 +1,17 @@
--- quota-tools/Makefile.in.orig 2002-07-17 17:07:14.000000000 -0400
+++ quota-tools/Makefile.in 2002-07-17 18:08:39.000000000 -0400
@@ -23,8 +23,8 @@ SUPER_OWNER = root
From e7747ee537e604102606caf5af9f26d7eee1ede9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Aug 2011 14:10:46 +0200
Subject: [PATCH] Do not strip binaries chmod them to 0755
---
Makefile.in | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 0b343a3..0f10472 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -17,8 +17,8 @@ SUPER_OWNER = root
BIN_OWNER = bin
BIN_GROUP = bin
DEF_SUID_MODE = 4511
@ -11,7 +22,7 @@
DEF_MAN_MODE = 444
DEF_CONF_MODE = 644
RPCGEN = rpcgen
@@ -87,10 +87,10 @@ install: all @INSTMO@
@@ -78,10 +78,10 @@ install: all @INSTMO@
-mkdir -p $(ROOTDIR)$(sbindir)
-mkdir -p $(ROOTDIR)$(bindir)
-mkdir -p $(ROOTDIR)$(root_sbindir)
@ -24,13 +35,13 @@
edquota repquota warnquota quotastats setquota quot xqmstats \
convertquota $(ROOTDIR)$(sbindir)
-mkdir -p $(ROOTDIR)$(sysconfdir)
@@ -99,10 +99,10 @@
@@ -94,10 +94,10 @@ install: all @INSTMO@
-mkdir -p $(ROOTDIR)$(mandir)/man8
-$(INSTALL) -m 755 -d $(ROOTDIR)$(includedir)/rpcsvc
-$(INSTALL) -m 644 rquota.h rquota.x $(ROOTDIR)$(includedir)/rpcsvc
- -$(INSTALL) $(STRIP) -m $(DEF_SBIN_MODE) quota $(ROOTDIR)$(bindir)
- -$(INSTALL) $(STRIP) -m $(DEF_SBIN_MODE) quota quotasync $(ROOTDIR)$(bindir)
- -$(INSTALL) $(STRIP) -m $(DEF_SBIN_MODE) rpc.rquotad $(ROOTDIR)$(sbindir)
+ -$(INSTALL) -m $(DEF_SBIN_MODE) quota $(ROOTDIR)$(bindir)
+ -$(INSTALL) -m $(DEF_SBIN_MODE) quota quotasync $(ROOTDIR)$(bindir)
+ -$(INSTALL) -m $(DEF_SBIN_MODE) rpc.rquotad $(ROOTDIR)$(sbindir)
ifneq ($(NETLINKLIBS),)
- -$(INSTALL) $(STRIP) -m $(DEF_SBIN_MODE) quota_nld $(ROOTDIR)$(sbindir)
@ -38,3 +49,6 @@
endif
-$(INSTALL) -m $(DEF_MAN_MODE) *.1 $(ROOTDIR)$(mandir)/man1
-$(INSTALL) -m $(DEF_MAN_MODE) *.2 $(ROOTDIR)$(mandir)/man2
--
1.7.6

View File

@ -1,28 +1,57 @@
--- quota-tools/warnquota.conf.orig 2005-07-19 11:51:07.000000000 -0400
+++ quota-tools/warnquota.conf 2007-02-15 14:58:38.000000000 -0500
From aaec5ef140322b9b4220ce49be3b2a89754f736c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Aug 2011 13:45:15 +0200
Subject: [PATCH] warnquota configuration tunes
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
accepted by upstream.
Some of the lines have been superseeded by other commits probably.
---
warnquota.c | 2 +-
warnquota.conf | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 2ca286f..3b78647 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -806,7 +806,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
verify_format(config->group_signature, "GROUP_SIGNATURE");
}
else if (!strcmp(var, "LDAP_MAIL")) {
- if(strcasecmp(value, "true") == 0)
+ if(strncasecmp(value, "true", 4) == 0)
config->use_ldap_mail = 1;
else
config->use_ldap_mail = 0;
diff --git a/warnquota.conf b/warnquota.conf
index 8801a88..bc95e2c 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -4,16 +4,16 @@
# and even blank lines
# values can be quoted:
-MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
-FROM = "bas@localhost"
-FROM = "bas@example.com"
+MAIL_CMD = "/usr/sbin/sendmail -t"
+FROM =
+FROM =
# but they don't have to be:
-SUBJECT = Hey, user, clean up your account!
-CC_TO = "sysadm@localhost"
-CC_TO = "sysadm@example.com"
+SUBJECT = NOTE: You are exceeding your allocated disk space limits
+CC_TO = "root@localhost"
# If you set this variable CC will be used only when user has less than
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
# 12 hours, 5 days)
# CC_BEFORE = 2 days
-SUPPORT = "support@myhost.com"
-SUPPORT = "support@example.com"
+SUPPORT = "root@myhost.com"
PHONE = "(123) 456-1111 or (222) 333-4444"
# Text in the beginning of the mail (if not specified, default text is used)
# This way text can be split to more lines
@@ -21,11 +21,11 @@ PHONE = "(123) 456-1111 or (222) 333-4
@@ -21,11 +21,11 @@ PHONE = "(123) 456-1111 or (222) 333-4444"
# The expressions %i, %h, %d, and %% are substituted for user/group name,
# host name, domain name, and '%' respectively. For backward compatibility
# %s behaves as %i but is deprecated.
@ -37,29 +66,6 @@
# Following text is used for mails about group exceeding quotas
GROUP_MESSAGE = Hello, a group '%i' you're member of use too much space at %h.|\
I chose you to do the cleanup.|Delete group files on the following filesystems:|
@@ -52,10 +52,10 @@ GROUP_SIGNATURE = See you!| Your admin
# if the attribute isn't found
# if binddn and bindpw are blank or left out, an anonymous bind is used
#
-# LDAP_MAIL = false # or false if you don't want to use it
-# If you have at least LDAP 2.3 installed, you can use LDAP_URI
+# LDAP_MAIL = false # or true if you want to use it
+# If you have at least LDAP 2.3 installed, you should use LDAP_URI
# LDAP_URI = ldaps://my.server:389
-# Otherwise you can specify LDAP_HOST and LDAP_PORT
+# Otherwise you should specify LDAP_HOST and LDAP_PORT
# LDAP_HOST = ldap
# LDAP_PORT = 389
# LDAP_BINDDN = uid=ReadOnlyUser,o=YourOrg
diff -urNp quota-tools-orig/warnquota.c quota-tools/warnquota.c
--- quota-tools-orig/warnquota.c 2008-10-13 19:29:18.000000000 +0200
+++ quota-tools/warnquota.c 2009-03-13 14:26:33.000000000 +0100
@@ -806,7 +806,7 @@ static int readconfigfile(const char *fi
verify_format(config->group_signature, "GROUP_SIGNATURE");
}
else if (!strcmp(var, "LDAP_MAIL")) {
- if(strcasecmp(value, "true") == 0)
+ if(strncasecmp(value, "true", 4) == 0)
config->use_ldap_mail = 1;
else
config->use_ldap_mail = 0;
--
1.7.6

View File

@ -1,28 +0,0 @@
From c7cfb6e73bb8e73e6dcf857b5ecf374679a778ab Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 14 Sep 2010 20:48:06 +0200
Subject: [PATCH 1/6] Add --always-resolve to quota.1 manpage
Signed-off-by: Jan Kara <jack@suse.cz>
---
quota.1 | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/quota.1 b/quota.1
index d562f12..11865af 100644
--- a/quota.1
+++ b/quota.1
@@ -96,6 +96,10 @@ option will make
.BR quota (1)
try to choose units for showing limits, used space and used inodes.
.TP
+.B --always-resolve
+Always try to translate user / group name to uid / gid even if the name
+is composed of digits only.
+.TP
.B -p, --raw-grace
When user is in grace period, report time in seconds since epoch when his grace
time runs out (or has run out). Field is '0' when no grace time is in effect.
--
1.7.3.4

View File

@ -1,182 +0,0 @@
From 1be8727ae92a78a5e7fde5ecc6c59740ca2eabe4 Mon Sep 17 00:00:00 2001
From: Abhijith Das <adas@redhat.com>
Date: Tue, 1 Feb 2011 17:16:12 +0100
Subject: [PATCH] Add quotasync tool
Add tool allowing to sync quotas for some / all filesystems.
Signed-off-by: Jan Kara <jack@suse.cz>
Petr Pisar: Remove STRIP from Makefile.in
---
Makefile.in | 8 ++-
quotasync.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 132 insertions(+), 3 deletions(-)
create mode 100644 quotasync.c
diff --git a/Makefile.in b/Makefile.in
index aeaa79f..0b343a3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
-PROGS = quotacheck quotaon quota quot repquota warnquota quotastats xqmstats edquota setquota convertquota rpc.rquotad @QUOTA_NETLINK_PROG@
-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_tree.c quotaio_xfs.c quotaio_meta.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
+PROGS = quotacheck quotaon quota quot repquota warnquota quotastats xqmstats edquota setquota convertquota rpc.rquotad quotasync @QUOTA_NETLINK_PROG@
+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_tree.c quotaio_xfs.c quotaio_meta.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 quotasync.c
CFLAGS = @CFLAGS@ -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
CPPFLAGS = @CPPFLAGS@
EXT2LIBS = @EXT2LIBS@
@@ -94,7 +94,7 @@ install: all @INSTMO@
-mkdir -p $(ROOTDIR)$(mandir)/man8
-$(INSTALL) -m 755 -d $(ROOTDIR)$(includedir)/rpcsvc
-$(INSTALL) -m 644 rquota.h rquota.x $(ROOTDIR)$(includedir)/rpcsvc
- -$(INSTALL) -m $(DEF_SBIN_MODE) quota $(ROOTDIR)$(bindir)
+ -$(INSTALL) -m $(DEF_SBIN_MODE) quota quotasync $(ROOTDIR)$(bindir)
-$(INSTALL) -m $(DEF_SBIN_MODE) rpc.rquotad $(ROOTDIR)$(sbindir)
ifneq ($(NETLINKLIBS),)
-$(INSTALL) -m $(DEF_SBIN_MODE) quota_nld $(ROOTDIR)$(sbindir)
@@ -111,6 +111,8 @@ quotacheck: quotacheck.o quotacheck_v1.o quotacheck_v2.o quotaops.o $(LIBOBJS)
quota: quota.o quotaops.o $(LIBOBJS)
+quotasync: quotasync.o $(LIBOBJS)
+
quot: quot.o $(LIBOBJS)
repquota: repquota.o $(LIBOBJS)
diff --git a/quotasync.c b/quotasync.c
new file mode 100644
index 0000000..0ce44c9
--- /dev/null
+++ b/quotasync.c
@@ -0,0 +1,127 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+
+#include "pot.h"
+#include "common.h"
+#include "quotasys.h"
+#include "quotaio.h"
+
+#define FL_USER 1 /* sync user quotas */
+#define FL_GROUP 2 /* sync group quotas */
+#define FL_ALL 4 /* sync quotas on all filesystems */
+
+int flags, fmt = -1;
+char **mnt;
+int mntcnt;
+char *progname;
+
+static void usage(void)
+{
+ errstr(_("Utility for syncing quotas.\nUsage:\n%s [-ug] -a | mntpoint...\n\n"), progname);
+ fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL);
+ exit(1);
+}
+
+static void parse_options(int argcnt, char **argstr)
+{
+ int ret;
+ struct option long_opts[] = {
+ { "user", 0, NULL, 'u' },
+ { "group", 0, NULL, 'g' },
+ { "all", 0, NULL, 'a' },
+ { "version", 0, NULL, 'V' },
+ { "help", 0, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ while ((ret = getopt_long(argcnt, argstr, "ahugV", long_opts, NULL)) != -1) {
+ switch (ret) {
+ case '?':
+ case 'h':
+ usage();
+ case 'V':
+ version();
+ exit(0);
+ case 'u':
+ flags |= FL_USER;
+ break;
+ case 'g':
+ flags |= FL_GROUP;
+ break;
+ case 'a':
+ flags |= FL_ALL;
+ break;
+ }
+ }
+
+ if ((flags & FL_ALL && optind != argcnt) ||
+ (!(flags & FL_ALL) && optind == argcnt)) {
+ fputs(_("Bad number of arguments.\n"), stderr);
+ usage();
+ }
+ if (!(flags & FL_ALL)) {
+ mnt = argstr + optind;
+ mntcnt = argcnt - optind;
+ }
+ if (!(flags & (FL_USER | FL_GROUP)))
+ flags |= FL_USER;
+}
+
+static int sync_one(int type, char *dev)
+{
+ int qcmd = QCMD(Q_SYNC, type);
+
+ return quotactl(qcmd, dev, 0, NULL);
+}
+
+int syncquotas(int type)
+{
+ struct quota_handle **handles, *h;
+ int i, ret = 0;
+
+ if (flags & FL_ALL) {
+ if (sync_one(type, NULL) < 0)
+ errstr(_("%s quota sync failed: %s\n"), type2name(type),
+ strerror(errno));
+ return -1;
+ }
+
+ handles = create_handle_list(mntcnt, mnt, type, fmt,
+ IOI_READONLY, MS_LOCALONLY | MS_NO_AUTOFS);
+
+ for (i = 0; handles[i]; i++) {
+ h = handles[i];
+ if (sync_one(type, h->qh_quotadev)) {
+ errstr(_("%s quota sync failed for %s: %s\n"),
+ type2name(type), h->qh_quotadev, strerror(errno));
+ ret = -1;
+ }
+ }
+ dispose_handle_list(handles);
+
+ return ret;
+}
+
+int main(int argc, char **argv)
+{
+ int ret = 0;
+
+ gettexton();
+ progname = basename(argv[0]);
+
+ parse_options(argc, argv);
+ init_kernel_interface();
+
+ if (flags & FL_USER)
+ if (syncquotas(USRQUOTA))
+ ret = 1;
+ if (flags & FL_GROUP)
+ if (syncquotas(GRPQUOTA))
+ ret = 1;
+ return ret;
+}
--
1.7.4

View File

@ -1,35 +0,0 @@
From f323a983893484104a3a981134cd8c3c75b9dd4d Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Thu, 2 Sep 2010 15:00:14 +0000
Subject: [PATCH] Added reference to setquota to quota(1) manpage. Fixed description of -m option
of edquota (Jan Kara)
Petr Pisar: Changelog entry removed.
diff --git a/edquota.8 b/edquota.8
index 7ade64a..d31d994 100644
--- a/edquota.8
+++ b/edquota.8
@@ -100,7 +100,7 @@ Currently, pathnames of NFSv4 mountpoints are sent without leading slash in the
.BR rpc.rquotad
uses this to recognize NFSv4 mounts and properly prepend pseudoroot of NFS filesystem
to the path. If you specify this option,
-.BR setquota
+.BR edquota
will always send paths with a trailing slash. This can be useful for legacy reasons but
be aware that quota over RPC will stop working if you are using new
.BR rpc.rquotad .
diff --git a/quota.1 b/quota.1
index 9d6a0a1..11f3da1 100644
--- a/quota.1
+++ b/quota.1
@@ -190,4 +190,5 @@ default filesystems
.BR quotaon (8),
.BR quota_nld (8),
.BR repquota (8),
-.BR warnquota (8)
+.BR warnquota (8),
+.BR setquota (8)
--
1.7.4

View File

@ -1,159 +0,0 @@
From 8a4dc3612c6c170c05e5eef68dd3555baeb341c1 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 6 Jan 2011 21:15:46 +0100
Subject: [PATCH 5/6] Check whether set limits fit into the range supported by quota format.
Petr Pisar: Changelog update remove
---
quotaio.c | 24 ++++++++++++++++++++++++
quotaio.h | 8 ++++++++
quotaio_v1.c | 8 ++++++++
quotaio_v2.c | 23 ++++++++++++++++++++++-
diff --git a/quotaio.c b/quotaio.c
index dbd7cc8..21881fc 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -287,3 +287,27 @@ struct dquot *get_empty_dquot(void)
dquot->dq_id = -1;
return dquot;
}
+
+/*
+ * Check whether values in current dquot can be stored on disk
+ */
+int check_dquot_range(struct dquot *dquot)
+{
+ struct util_dqinfo *info = &dquot->dq_h->qh_info;
+
+ if (dquot->dq_dqb.dqb_bhardlimit > info->dqi_max_b_limit ||
+ dquot->dq_dqb.dqb_bsoftlimit > info->dqi_max_b_limit ||
+ dquot->dq_dqb.dqb_ihardlimit > info->dqi_max_i_limit ||
+ dquot->dq_dqb.dqb_isoftlimit > info->dqi_max_i_limit) {
+ errstr(_("Trying to set quota limits out of range "
+ "supported by quota format on %s.\n"), dquot->dq_h->qh_quotadev);
+ return -1;
+ }
+ if (dquot->dq_dqb.dqb_curinodes > info->dqi_max_i_usage ||
+ dquot->dq_dqb.dqb_curspace > info->dqi_max_b_usage) {
+ errstr(_("Trying to set quota usage out of range "
+ "supported by quota format on %s.\n"), dquot->dq_h->qh_quotadev);
+ return -1;
+ }
+ return 0;
+}
diff --git a/quotaio.h b/quotaio.h
index d797034..3cd33ba 100644
--- a/quotaio.h
+++ b/quotaio.h
@@ -10,6 +10,7 @@
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdint.h>
#include "quota.h"
#include "mntopt.h"
@@ -69,6 +70,10 @@ struct quotafile_ops;
struct util_dqinfo {
time_t dqi_bgrace; /* Block grace time for given quotafile */
time_t dqi_igrace; /* Inode grace time for given quotafile */
+ uint64_t dqi_max_b_limit; /* Maximal block limit storable in current format */
+ uint64_t dqi_max_i_limit; /* Maximal inode limit storable in current format */
+ uint64_t dqi_max_b_usage; /* Maximal block usage storable in current format */
+ uint64_t dqi_max_i_usage; /* Maximal inode usage storable in current format */
union {
struct v2_mem_dqinfo v2_mdqi;
struct xfs_mem_dqinfo xfs_mdqi;
@@ -171,4 +176,7 @@ int end_io(struct quota_handle *h);
/* Get empty quota structure */
struct dquot *get_empty_dquot(void);
+/* Check whether values in current dquot can be stored on disk */
+int check_dquot_range(struct dquot *dquot);
+
#endif /* GUARD_QUOTAIO_H */
diff --git a/quotaio_v1.c b/quotaio_v1.c
index 1533ffc..305bff2 100644
--- a/quotaio_v1.c
+++ b/quotaio_v1.c
@@ -174,6 +174,10 @@ static int v1_init_io(struct quota_handle *h)
h->qh_info.dqi_bgrace = MAX_DQ_TIME;
if (!h->qh_info.dqi_igrace)
h->qh_info.dqi_igrace = MAX_IQ_TIME;
+ h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0)) << V1_DQBLK_SIZE_BITS;
+ h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
return 0;
}
@@ -327,6 +331,10 @@ static int v1_commit_dquot(struct dquot *dquot, int flags)
}
}
else {
+ if (check_dquot_range(dquot) < 0) {
+ errno = ERANGE;
+ return -1;
+ }
v1_mem2diskdqblk(&ddqblk, &dquot->dq_dqb);
lseek(h->qh_fd, (long)V1_DQOFF(dquot->dq_id), SEEK_SET);
if (write(h->qh_fd, &ddqblk, sizeof(ddqblk)) != sizeof(ddqblk))
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 38440e7..2242c88 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -307,9 +307,17 @@ static int v2_init_io(struct quota_handle *h)
if (__le32_to_cpu(header.dqh_version) == 0) {
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size = sizeof(struct v2r0_disk_dqblk);
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r0_fmt_ops;
+ h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_b_usage = ~(uint64_t)0;
+ h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
} else {
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size = sizeof(struct v2r1_disk_dqblk);
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r1_fmt_ops;
+ h->qh_info.dqi_max_b_limit = ~(uint64_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint64_t)0;
+ h->qh_info.dqi_max_b_usage = ~(uint64_t)0;
+ h->qh_info.dqi_max_i_usage = ~(uint64_t)0;
}
} else {
/* We don't have the file open -> we don't need quota tree operations */
@@ -351,9 +359,17 @@ static int v2_new_io(struct quota_handle *h)
if (version == 0) {
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size = sizeof(struct v2r0_disk_dqblk);
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r0_fmt_ops;
+ h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_b_usage = ~(uint64_t)0;
+ h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
} else if (version == 1) {
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_entry_size = sizeof(struct v2r1_disk_dqblk);
h->qh_info.u.v2_mdqi.dqi_qtree.dqi_ops = &v2r1_fmt_ops;
+ h->qh_info.dqi_max_b_limit = ~(uint64_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint64_t)0;
+ h->qh_info.dqi_max_b_usage = ~(uint64_t)0;
+ h->qh_info.dqi_max_i_usage = ~(uint64_t)0;
}
v2_mem2diskdqinfo(&ddqinfo, &h->qh_info);
lseek(h->qh_fd, V2_DQINFOOFF, SEEK_SET);
@@ -477,8 +493,13 @@ static int v2_commit_dquot(struct dquot *dquot, int flags)
if (!b->dqb_curspace && !b->dqb_curinodes && !b->dqb_bsoftlimit && !b->dqb_isoftlimit
&& !b->dqb_bhardlimit && !b->dqb_ihardlimit)
qtree_delete_dquot(dquot);
- else
+ else {
+ if (check_dquot_range(dquot) < 0) {
+ errno = ERANGE;
+ return -1;
+ }
qtree_write_dquot(dquot);
+ }
return 0;
}
--
1.7.3.4

View File

@ -1,57 +0,0 @@
From 2bbd79d4eb6b712f80364ddd9e3549de30529674 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 12 Jan 2011 16:30:53 +0100
Subject: [PATCH] Correct --no-mixed-pathnames documentation
This option controls a leading slash, not a trailing one.
The quota(1) page talks about quota, not about setquota.
---
edquota.8 | 2 +-
quota.1 | 4 ++--
setquota.8 | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/edquota.8 b/edquota.8
index 9b7ffd4..4b1406b 100644
--- a/edquota.8
+++ b/edquota.8
@@ -101,7 +101,7 @@ Currently, pathnames of NFSv4 mountpoints are sent without leading slash in the
uses this to recognize NFSv4 mounts and properly prepend pseudoroot of NFS filesystem
to the path. If you specify this option,
.BR edquota
-will always send paths with a trailing slash. This can be useful for legacy reasons but
+will always send paths with a leading slash. This can be useful for legacy reasons but
be aware that quota over RPC will stop working if you are using new
.BR rpc.rquotad .
.TP
diff --git a/quota.1 b/quota.1
index 11865af..7a62764 100644
--- a/quota.1
+++ b/quota.1
@@ -123,8 +123,8 @@ Currently, pathnames of NFSv4 mountpoints are sent without leading slash in the
.BR rpc.rquotad
uses this to recognize NFSv4 mounts and properly prepend pseudoroot of NFS filesystem
to the path. If you specify this option,
-.BR setquota
-will always send paths with a trailing slash. This can be useful for legacy reasons but
+.BR quota
+will always send paths with a leading slash. This can be useful for legacy reasons but
be aware that quota over RPC will stop working if you are using new
.BR rpc.rquotad .
.TP
diff --git a/setquota.8 b/setquota.8
index c7fe408..472279d 100644
--- a/setquota.8
+++ b/setquota.8
@@ -126,7 +126,7 @@ Currently, pathnames of NFSv4 mountpoints are sent without leading slash in the
uses this to recognize NFSv4 mounts and properly prepend pseudoroot of NFS filesystem
to the path. If you specify this option,
.BR setquota
-will always send paths with a trailing slash. This can be useful for legacy reasons but
+will always send paths with a leading slash. This can be useful for legacy reasons but
be aware that quota over RPC will stop working if you are using new
.BR rpc.rquotad .
.TP
--
1.7.3.4

View File

@ -1,45 +0,0 @@
From 615816942190923d911edf397334bdc170a1178d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 10 Jan 2011 16:38:22 +0100
Subject: [PATCH] Document --always-resolve at edquota and setquota
This copy --always-resolve option description for quota(1) into
edquota(8) and setquota(8) manuals.
---
edquota.8 | 4 ++++
setquota.8 | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/edquota.8 b/edquota.8
index d31d994..9b7ffd4 100644
--- a/edquota.8
+++ b/edquota.8
@@ -116,6 +116,10 @@ Duplicate the quotas of the prototypical user
specified for each user specified. This is the normal
mechanism used to initialize quotas for groups of users.
.TP
+.B --always-resolve
+Always try to translate user / group name to uid / gid even if the name
+is composed of digits only.
+.TP
.B -F, --format=\f2format-name\f1
Edit quota for specified format (ie. don't perform format autodetection).
Possible format names are:
diff --git a/setquota.8 b/setquota.8
index 624deec..c7fe408 100644
--- a/setquota.8
+++ b/setquota.8
@@ -155,6 +155,10 @@ Use quota settings of user or group
.I protoname
to set the quota for the named user or group.
.TP
+.B --always-resolve
+Always try to translate user / group name to uid / gid even if the name
+is composed of digits only.
+.TP
.B -b, --batch
Read information to set from stdin (input format is
.I name block-softlimit block-hardlimit inode-softlimit inode-hardlimit
--
1.7.3.4

View File

@ -1,48 +0,0 @@
From fe76269491078b4ac862d3009a2e14c51884868a Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 16 Feb 2011 18:33:32 +0100
Subject: [PATCH 1/2] Explain meaning of the second column in repquota output
Signed-off-by: Jan Kara <jack@suse.cz>
---
repquota.8 | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/repquota.8 b/repquota.8
index 7580f64..a71cf6b 100644
--- a/repquota.8
+++ b/repquota.8
@@ -48,18 +48,25 @@ repquota \- summarize quotas for a filesystem
.B repquota
prints a summary of the disc usage and quotas for the specified file
systems. For each user the current number of files and amount of space
-(in kilobytes) is printed, along with any quotas created with
-.BR edquota (8).
-As
+(in kilobytes) is printed, along with any quota limits set with
+.BR edquota (8)
+or
+.BR setquota (8).
+In the second column repquota prints two characters marking which limits are
+exceeded. If user is over his space softlimit or reaches his space hardlimit in
+case softlimit is unset, the first character is '+'. Otherwise the character
+printed is '-'. The second character denotes the state of inode usage
+analogously.
+
.B repquota
has to translate ids of all users/groups to names (unless option
.B -n
-was specified) it may take a while to
+was specified) so it may take a while to
print all the information. To make translating as fast as possible
.B repquota
tries to detect (by reading
.BR /etc/nsswitch.conf )
-whether entries are stored in standard plain text file or in database and either
+whether entries are stored in standard plain text file or in a database and either
translates chunks of 1024 names or each name individually. You can override this
autodetection by
.B -c
--
1.7.4

View File

@ -1,41 +0,0 @@
From 797913a0c470da93d44201d074d343953a38589c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 11 Mar 2011 11:06:20 +0100
Subject: [PATCH] Fix ddquot buffer leak
The ddquot buffer is used to tranfer data from/to file. All its data are
copied from/to it, so it's not needed after return from qtree_read_dquot()/
qtree_write_dquot().
---
quotaio_tree.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/quotaio_tree.c b/quotaio_tree.c
index cdc0e8f..9f87889 100644
--- a/quotaio_tree.c
+++ b/quotaio_tree.c
@@ -272,6 +272,7 @@ void qtree_write_dquot(struct dquot *dquot)
lseek(dquot->dq_h->qh_fd, dquot->dq_dqb.u.v2_mdqb.dqb_off, SEEK_SET);
info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
ret = write(dquot->dq_h->qh_fd, ddquot, info->dqi_entry_size);
+ free(ddquot);
if (ret != info->dqi_entry_size) {
if (ret > 0)
errno = ENOSPC;
@@ -421,11 +422,13 @@ struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
if (ret != info->dqi_entry_size) {
if (ret > 0)
errno = EIO;
+ free(ddquot);
die(2, _("Cannot read quota structure for id %u: %s\n"), dquot->dq_id,
strerror(errno));
}
info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
}
+ free(ddquot);
return dquot;
}
--
1.7.4

View File

@ -1,85 +0,0 @@
From 8d4c4a761c27a81d96ae8c49e1b8d32d66b6751e Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 8 Mar 2011 23:36:47 +0100
Subject: [PATCH 1/2] Fix synopsis and properly report errors during remote grace period setting
Signed-off-by: Jan Kara <jack@suse.cz>
---
edquota.8 | 2 ++
setquota.8 | 4 +---
setquota.c | 11 ++++++++---
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/edquota.8 b/edquota.8
index 4b1406b..2ef4cb6 100644
--- a/edquota.8
+++ b/edquota.8
@@ -38,6 +38,8 @@ edquota \- edit user quotas
.BR \-u \ |
.B \-g
] [
+.B \-rm
+] [
.B \-F
.I format-name
] [
diff --git a/setquota.8 b/setquota.8
index e3ac7e0..6c3dc88 100644
--- a/setquota.8
+++ b/setquota.8
@@ -67,8 +67,6 @@ setquota \- set disk quotas
.B setquota
.B \-t
[
-.B \-m
-] [
.B \-u
|
.B \-g
@@ -86,7 +84,7 @@ setquota \- set disk quotas
.B setquota
.B \-T
[
-.B \-m
+.B \-rm
] [
.B \-u
|
diff --git a/setquota.c b/setquota.c
index 5d2734b..d1cffcb 100644
--- a/setquota.c
+++ b/setquota.c
@@ -58,7 +58,7 @@ static void usage(void)
setquota [-u|-g] %1$s[-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n\
setquota [-u|-g] %1$s[-F quotaformat] -b [-c] -a|<filesystem>...\n\
setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n\
- setquota [-u|-g] [-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
+ setquota [-u|-g] %1$s[-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
-u, --user set limits for user\n\
-g, --group set limits for group\n\
-a, --all set limits for all filesystems\n\
@@ -372,14 +372,19 @@ static int batch_setlimits(struct quota_handle **handles)
/* Set grace times */
static int setgraces(struct quota_handle **handles)
{
- int i;
+ int i, ret = 0;
for (i = 0; handles[i]; i++) {
+ if (handles[i]->qh_ops->write_info) {
+ errstr(_("Setting grace period on %s is not supported.\n"), handles[i]->qh_quotadev);
+ ret = -1;
+ continue;
+ }
handles[i]->qh_info.dqi_bgrace = toset.dqb_btime;
handles[i]->qh_info.dqi_igrace = toset.dqb_itime;
mark_quotafile_info_dirty(handles[i]);
}
- return 0;
+ return ret;
}
/* Set grace times for individual user */
--
1.7.4

View File

@ -1,95 +0,0 @@
From 418a9f20ee870953790b4331327ccb24ca8f1e47 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 9 Mar 2011 15:37:37 +0100
Subject: [PATCH 2/2] Forbid grace time setting over RPC
Testing revealed that it's not easy to set even individual grace times
over RPC protocol. Since the usage of it is limited, just disallow that.
Signed-off-by: Jan Kara <jack@suse.cz>
---
edquota.8 | 2 --
edquota.c | 8 ++++++--
setquota.8 | 2 --
setquota.c | 6 +++++-
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/edquota.8 b/edquota.8
index 2ef4cb6..4b1406b 100644
--- a/edquota.8
+++ b/edquota.8
@@ -38,8 +38,6 @@ edquota \- edit user quotas
.BR \-u \ |
.B \-g
] [
-.B \-rm
-] [
.B \-F
.I format-name
] [
diff --git a/edquota.c b/edquota.c
index c0b2f76..4d247fa 100644
--- a/edquota.c
+++ b/edquota.c
@@ -80,8 +80,8 @@ void usage(void)
#endif
errstr(_("Usage:\n\tedquota %1$s[-u] [-F formatname] [-p username] [-f filesystem] username ...\n\
\tedquota %1$s-g [-F formatname] [-p groupname] [-f filesystem] groupname ...\n\
-\tedquota %1$s[-u|g] [-F formatname] [-f filesystem] -t\n\
-\tedquota %1$s[-u|g] [-F formatname] [-f filesystem] -T username|groupname ...\n"), rpcflag);
+\tedquota [-u|g] [-F formatname] [-f filesystem] -t\n\
+\tedquota [-u|g] [-F formatname] [-f filesystem] -T username|groupname ...\n"), rpcflag);
fputs(_("\n\
-u, --user edit user data\n\
-g, --group edit group data\n"), stderr);
@@ -183,6 +183,10 @@ int parse_options(int argc, char **argv)
errstr(_("Prototype name does not make sense when editing grace period or times.\n"));
usage();
}
+ if (flags & FL_REMOTE && (flags & (FL_EDIT_TIMES | FL_EDIT_PERIOD))) {
+ errstr(_("Cannot change grace times over RPC protocol.\n"));
+ usage();
+ }
return optind;
}
diff --git a/setquota.8 b/setquota.8
index 6c3dc88..db9d054 100644
--- a/setquota.8
+++ b/setquota.8
@@ -84,8 +84,6 @@ setquota \- set disk quotas
.B setquota
.B \-T
[
-.B \-rm
-] [
.B \-u
|
.B \-g
diff --git a/setquota.c b/setquota.c
index d1cffcb..fe29ec2 100644
--- a/setquota.c
+++ b/setquota.c
@@ -58,7 +58,7 @@ static void usage(void)
setquota [-u|-g] %1$s[-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n\
setquota [-u|-g] %1$s[-F quotaformat] -b [-c] -a|<filesystem>...\n\
setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n\
- setquota [-u|-g] %1$s[-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
+ setquota [-u|-g] [-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
-u, --user set limits for user\n\
-g, --group set limits for group\n\
-a, --all set limits for all filesystems\n\
@@ -202,6 +202,10 @@ static void parse_options(int argcnt, char **argstr)
errstr(_("Batch mode and prototype user cannot be used together.\n"));
usage();
}
+ if (flags & FL_RPC && (flags & (FL_GRACE | FL_INDIVIDUAL_GRACE))) {
+ errstr(_("Cannot set grace times over RPC protocol.\n"));
+ usage();
+ }
if (flags & FL_GRACE)
otherargs = 2;
else if (flags & FL_INDIVIDUAL_GRACE)
--
1.7.4

View File

@ -1,213 +0,0 @@
From fa920711b4bbb9e61358a7f488f0a645ef221321 Mon Sep 17 00:00:00 2001
From: Abhijith Das <adas@redhat.com>
Date: Fri, 4 Feb 2011 12:40:58 +0100
Subject: [PATCH] Implement quotacheck for GFS2
Although GFS2 maintains quota as metadata, it sometimes might need to
check quota usage (most notably when quota is enabled for the first time).
So add support for GFS2 in quotacheck.
Signed-off-by: Jan Kara <jack@suse.cz>
Petr Pisar: Remove MNTTYPE_NEXT3 test
---
quotacheck.c | 82 +++++++++++++++++++++++++++++++++++++++++++--------------
quotaio_xfs.c | 12 +++++++-
quotaio_xfs.h | 9 ++++++
3 files changed, 82 insertions(+), 21 deletions(-)
diff --git a/quotacheck.c b/quotacheck.c
index fec9ec3..7ecf62d 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -404,10 +404,6 @@ static void parse_options(int argcnt, char **argstr)
fputs(_("Bad number of arguments.\n"), stderr);
usage();
}
- if (fmt == QF_XFS) {
- fputs(_("XFS quota format needs no checking.\n"), stderr);
- exit(0);
- }
if (flags & FL_VERBOSE && flags & FL_DEBUG)
flags &= ~FL_VERBOSE;
if (!(flags & FL_ALL))
@@ -689,6 +685,9 @@ static int rename_files(struct mntent *mnt, int type)
int fd;
#endif
+ if (cfmt == QF_XFS) /* No renaming for xfs/gfs2 */
+ return 0;
+
debug(FL_DEBUG, _("Renaming new files to proper names.\n"));
if (get_qf_name(mnt, type, cfmt, 0, &filename) < 0)
die(2, _("Cannot get name of old quotafile on %s.\n"), mnt->mnt_dir);
@@ -787,25 +786,42 @@ static int dump_to_file(struct mntent *mnt, int type)
struct dquot *dquot;
uint i;
struct quota_handle *h;
+ unsigned int commit = 0;
debug(FL_DEBUG, _("Dumping gathered data for %ss.\n"), type2name(type));
- if (!(h = new_io(mnt, type, cfmt))) {
- errstr(_("Cannot initialize IO on new quotafile: %s\n"),
- strerror(errno));
- return -1;
- }
- if (!(flags & FL_NEWFILE)) {
- h->qh_info.dqi_bgrace = old_info[type].dqi_bgrace;
- h->qh_info.dqi_igrace = old_info[type].dqi_igrace;
- if (is_tree_qfmt(cfmt))
- v2_merge_info(&h->qh_info, old_info + type);
- mark_quotafile_info_dirty(h);
+ if (cfmt == QF_XFS) {
+ if (!(h = init_io(mnt, type, cfmt, IOI_READONLY))) {
+ errstr(_("Cannot initialize IO on xfs/gfs2 quotafile: %s\n"),
+ strerror(errno));
+ return -1;
+ }
+ } else {
+ if (!(h = new_io(mnt, type, cfmt))) {
+ errstr(_("Cannot initialize IO on new quotafile: %s\n"),
+ strerror(errno));
+ return -1;
+ }
+ if (!(flags & FL_NEWFILE)) {
+ h->qh_info.dqi_bgrace = old_info[type].dqi_bgrace;
+ h->qh_info.dqi_igrace = old_info[type].dqi_igrace;
+ if (is_tree_qfmt(cfmt))
+ v2_merge_info(&h->qh_info, old_info + type);
+ mark_quotafile_info_dirty(h);
+ }
}
for (i = 0; i < DQUOTHASHSIZE; i++)
for (dquot = dquot_hash[type][i]; dquot; dquot = dquot->dq_next) {
dquot->dq_h = h;
+ /* For XFS/GFS2, we don't bother with actually checking
+ * what the usage value is in the internal quota file.
+ * We simply attempt to update the usage for every quota
+ * we find in the fs scan. The filesystem decides in the
+ * quotactl handler whether to update the usage in the
+ * quota file or not.
+ */
+ commit = cfmt == QF_XFS ? COMMIT_USAGE : COMMIT_ALL;
update_grace_times(dquot);
- h->qh_ops->commit_dquot(dquot, COMMIT_ALL);
+ h->qh_ops->commit_dquot(dquot, commit);
}
if (end_io(h) < 0) {
errstr(_("Cannot finish IO on new quotafile: %s\n"), strerror(errno));
@@ -893,6 +909,14 @@ static void check_dir(struct mntent *mnt)
die(2, _("Mountpoint %s is not a directory?!\n"), mnt->mnt_dir);
cur_dev = st.st_dev;
files_done = dirs_done = 0;
+ /*
+ * For gfs2, we scan the fs first and then tell the kernel about the new usage.
+ * So, there's no need to load any information. We also don't remount the
+ * filesystem read-only because for a clustering filesystem it won't stop
+ * modifications from other nodes anyway.
+ */
+ if (cfmt == QF_XFS)
+ goto start_scan;
if (ucheck)
if (process_file(mnt, USRQUOTA) < 0)
ucheck = 0;
@@ -923,6 +947,7 @@ Please stop all programs writing to filesystem or use -m flag to force checking.
remounted = 1;
debug(FL_DEBUG, _("Filesystem remounted read-only\n"));
}
+start_scan:
debug(FL_VERBOSE, _("Scanning %s [%s] "), mnt->mnt_fsname, mnt->mnt_dir);
#if defined(EXT2_DIRECT)
if (!strcmp(mnt->mnt_type, MNTTYPE_EXT2) || !strcmp(mnt->mnt_type, MNTTYPE_EXT3)) {
@@ -973,6 +998,10 @@ static int detect_filename_format(struct mntent *mnt, int type)
int journal = 0;
int fmt;
+ if (strcmp(mnt->mnt_type, MNTTYPE_XFS) == 0 ||
+ strcmp(mnt->mnt_type, MNTTYPE_GFS2) == 0)
+ return QF_XFS;
+
if (type == USRQUOTA) {
if ((option = hasmntopt(mnt, MNTOPT_USRQUOTA)))
option += strlen(MNTOPT_USRQUOTA);
@@ -1040,6 +1069,22 @@ jquota_err:
return -1;
}
+static int compatible_fs_qfmt(char *fstype, int fmt)
+{
+ /* We never check XFS, NFS, and filesystems supporting VFS metaformat */
+ if (!strcmp(fstype, MNTTYPE_XFS) || nfs_fstype(fstype) ||
+ meta_qf_fstype(fstype))
+ return 0;
+ /* In all other cases we can pick a format... */
+ if (fmt == -1)
+ return 1;
+ /* XFS format is supported only by GFS2 */
+ if (fmt == QF_XFS)
+ return !strcmp(fstype, MNTTYPE_GFS2);
+ /* Anything but GFS2 supports all other formats */
+ return !!strcmp(fstype, MNTTYPE_GFS2);
+}
+
static void check_all(void)
{
struct mntent *mnt;
@@ -1051,10 +1096,7 @@ static void check_all(void)
while ((mnt = get_next_mount())) {
if (flags & FL_ALL && flags & FL_NOROOT && !strcmp(mnt->mnt_dir, "/"))
continue;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
- !strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
- nfs_fstype(mnt->mnt_type) ||
- meta_qf_fstype(mnt->mnt_type)) {
+ if (!compatible_fs_qfmt(mnt->mnt_type, fmt)) {
debug(FL_DEBUG | FL_VERBOSE, _("Skipping %s [%s]\n"), mnt->mnt_fsname, mnt->mnt_dir);
continue;
}
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 4729317..62075b5 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -151,7 +151,17 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
return 0;
xfs_util2kerndqblk(&xdqblk, &dquot->dq_dqb);
- xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ xdqblk.d_flags |= XFS_USRQUOTA(h) ? XFS_USER_QUOTA : XFS_GROUP_QUOTA;
+ xdqblk.d_id = id;
+ if (strcmp(h->qh_fstype, MNTTYPE_GFS2) == 0) {
+ if (flags & COMMIT_LIMITS) /* warn/limit */
+ xdqblk.d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD;
+ if (flags & COMMIT_USAGE) /* block usage */
+ xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
+ } else {
+ xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ }
+
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
if (quotactl(qcmd, h->qh_quotadev, id, (void *)&xdqblk) < 0) {
;
diff --git a/quotaio_xfs.h b/quotaio_xfs.h
index cf89973..54725b0 100644
--- a/quotaio_xfs.h
+++ b/quotaio_xfs.h
@@ -105,6 +105,15 @@ typedef struct fs_disk_quota {
#define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER)
/*
+ * Accounting values. These can only be set for filesystem with
+ * non-transactional quotas that require quotacheck(8) in userspace.
+ */
+#define FS_DQ_BCOUNT (1<<12)
+#define FS_DQ_ICOUNT (1<<13)
+#define FS_DQ_RTBCOUNT (1<<14)
+#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
+
+/*
* Various flags related to quotactl(2). Only relevant to XFS filesystems.
*/
#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
--
1.7.4

View File

@ -1,30 +0,0 @@
From e482f256411dba6a9d647e6df7f24eef8af3d59b Mon Sep 17 00:00:00 2001
From: Petr Pisar <ppisar@redhat.com>
Date: Thu, 7 Apr 2011 16:26:51 +0200
Subject: [PATCH] Initialize v2r1 ddquot padding in dump
v2r1_mem2diskdqblk() that writes quota structure into memory block
calls tree_entry_unused() to decide the structure is in use (and
rewrites UID then). However tree_entry_unused() scan can be spoiled
because padding is not initialized and contains random value.
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotaio_v2.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 2242c88..06be04e 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -144,6 +144,7 @@ static void v2r1_mem2diskdqblk(void *dp, struct dquot *dquot)
d->dqb_itime = __cpu_to_le64(m->dqb_itime);
d->dqb_btime = __cpu_to_le64(m->dqb_btime);
d->dqb_id = __cpu_to_le32(dquot->dq_id);
+ d->dqb_pad = 0; /* Initialize because of qtree_entry_unused() scan */
if (qtree_entry_unused(&dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree, dp))
d->dqb_itime = __cpu_to_le64(1);
}
--
1.7.4.2

View File

@ -1,32 +0,0 @@
From 7313d70407961939fda2b46c7d3c00cc98fe412e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Feb 2011 15:40:08 +0100
Subject: [PATCH] Initialize vfsold block and inode value boundries for new quota file
Otherwise `quotackech -c -F vfsold' fails with `Trying to set quota
usage out of range supported by quota format on...' because initial
boundry is zero.
Fixes SF bug #3176326.
---
quotaio_v1.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/quotaio_v1.c b/quotaio_v1.c
index 305bff2..61bd93e 100644
--- a/quotaio_v1.c
+++ b/quotaio_v1.c
@@ -195,6 +195,10 @@ static int v1_new_io(struct quota_handle *h)
ddqblk.dqb_itime = MAX_IQ_TIME;
h->qh_info.dqi_bgrace = MAX_DQ_TIME;
h->qh_info.dqi_igrace = MAX_IQ_TIME;
+ h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
+ h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0)) << V1_DQBLK_SIZE_BITS;
+ h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
lseek(h->qh_fd, 0, SEEK_SET);
if (write(h->qh_fd, &ddqblk, sizeof(ddqblk)) != sizeof(ddqblk))
return -1;
--
1.7.4

View File

@ -1,91 +0,0 @@
From b8ab76ad19e3c284ac14bd0450662bfc41719e03 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 16 Feb 2011 22:19:55 +0100
Subject: [PATCH 2/2] Make RPC handle properly host names with colons
NFS handles server names with colons (usually IPv6 addresses) by encapsulating
them in brackets. Handle this properly.
Signed-off-by: Jan Kara <jack@suse.cz>
---
rquota_client.c | 48 +++++++++++++++++++++++++++++++++---------------
1 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/rquota_client.c b/rquota_client.c
index cc1d623..53e0579 100644
--- a/rquota_client.c
+++ b/rquota_client.c
@@ -104,6 +104,35 @@ int rquota_err(int stat)
}
}
+static int split_nfs_mount(char *devname, char **host, char **path)
+{
+ char *pathname;
+
+ /* NFS server name contained in brackets? */
+ if (*devname == '[') {
+ *host = devname + 1;
+ pathname = strchr(devname, ']');
+ if (!pathname || pathname[1] != ':')
+ return 0;
+ /* Autofs? */
+ if (pathname[2] == '(')
+ return 0;
+ *pathname = 0;
+ *path = pathname + 2;
+ return 1;
+ }
+ *host = devname;
+ pathname = strchr(devname, ':');
+ if (!pathname)
+ return 0;
+ /* Autofs? */
+ if (pathname[1] == '(')
+ return 0;
+ *pathname = 0;
+ *path = pathname + 1;
+ return 1;
+}
+
/*
* Collect the requested quota information from a remote host.
*/
@@ -128,13 +157,7 @@ int rpc_rquota_get(struct dquot *dquot)
*/
fsname_tmp = (char *)smalloc(strlen(dquot->dq_h->qh_quotadev) + 1);
strcpy(fsname_tmp, dquot->dq_h->qh_quotadev);
- host = fsname_tmp;
-
- /*
- * Strip off pathname on nfs mounted dir. Ignore entries of any
- * automounter.
- */
- if ((pathname = strchr(fsname_tmp, ':')) == (char *)0 || *(pathname + 1) == '(') {
+ if (!split_nfs_mount(fsname_tmp, &host, &pathname)) {
free(fsname_tmp);
return -ENOENT;
}
@@ -247,16 +270,11 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
*/
fsname_tmp = (char *)smalloc(strlen(dquot->dq_h->qh_quotadev) + 1);
strcpy(fsname_tmp, dquot->dq_h->qh_quotadev);
- host = fsname_tmp;
-
- /*
- * Strip off pathname on nfs mounted dir. Ignore entries of any
- * automounter.
- */
- if ((pathname = strchr(fsname_tmp, ':')) == (char *)0 || *(pathname + 1) == '(')
+ if (!split_nfs_mount(fsname_tmp, &host, &pathname)) {
+ free(fsname_tmp);
return -ENOENT;
+ }
- *pathname++ = '\0';
/* For NFSv4, we send the filesystem path without initial /. Server prepends proper
* NFS pseudoroot automatically and uses this for detection of NFSv4 mounts. */
if ((dquot->dq_h->qh_io_flags & IOFL_NFS_MIXED_PATHS) &&
--
1.7.4

View File

@ -1,28 +0,0 @@
From 41974689e041dbe9625a2e1435b195ed5e94d40f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 12 May 2011 13:44:26 +0200
Subject: [PATCH] Make dirname static
The `dirname' variable name clashes with libc dirname(3). This could
cause edquota to segfault if name server switch is configured to use
`db' back-end that attempts to call dirname(3).
---
edquota.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/edquota.c b/edquota.c
index 4d247fa..0d72882 100644
--- a/edquota.c
+++ b/edquota.c
@@ -69,7 +69,7 @@ char *progname;
int flags, quotatype;
int fmt = -1;
char *protoname;
-char *dirname;
+static char *dirname;
void usage(void)
{
--
1.7.4.4

View File

@ -1,203 +0,0 @@
From 0694c7dae6acec8ee54ca885417b0628cf0501d6 Mon Sep 17 00:00:00 2001
From: Petr Pisar <ppisar@redhat.com>
Date: Fri, 1 Jul 2011 10:13:54 +0200
Subject: [PATCH] Report quotacheck failures by return code
Signed-off-by: Jan Kara <jack@suse.cz>
Petr Pisar: Back-ported (missing NEXT3 support)
---
quotacheck.c | 57 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/quotacheck.c b/quotacheck.c
index 07b0c0d..cf2be9c 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -859,8 +859,9 @@ static int dump_to_file(struct mntent *mnt, int type)
return 0;
}
-/* Substract space used by old quota file from usage */
-static void sub_quota_file(struct mntent *mnt, int qtype, int ftype)
+/* Substract space used by old quota file from usage.
+ * Return non-zero in case of failure, zero otherwise. */
+static int sub_quota_file(struct mntent *mnt, int qtype, int ftype)
{
char *filename;
struct stat st;
@@ -871,13 +872,13 @@ static void sub_quota_file(struct mntent *mnt, int qtype, int ftype)
debug(FL_DEBUG, _("Substracting space used by old %s quota file.\n"), type2name(ftype));
if (get_qf_name(mnt, ftype, cfmt, 0, &filename) < 0) {
debug(FL_VERBOSE, _("Old %s file not found. Usage will not be substracted.\n"), type2name(ftype));
- return;
+ return 0;
}
if (stat(filename, &st) < 0) {
debug(FL_VERBOSE, _("Cannot stat old %s quota file: %s\n"), type2name(ftype), strerror(errno));
free(filename);
- return;
+ return 0;
}
qspace = getqsize(filename, &st);
free(filename);
@@ -888,18 +889,21 @@ static void sub_quota_file(struct mntent *mnt, int qtype, int ftype)
id = st.st_gid;
if ((d = lookup_dquot(id, qtype)) == NODQUOT) {
errstr(_("Quota structure for %s owning quota file not present! Something is really wrong...\n"), type2name(qtype));
- return;
+ return -1;
}
d->dq_dqb.dqb_curinodes--;
d->dq_dqb.dqb_curspace -= qspace;
debug(FL_DEBUG, _("Substracted %lu bytes.\n"), (unsigned long)qspace);
+ return 0;
}
-/* Buffer quotafile, run filesystem scan, dump quotafiles */
-static void check_dir(struct mntent *mnt)
+/* Buffer quotafile, run filesystem scan, dump quotafiles.
+ * Return non-zero value in case of failure, zero otherwise. */
+static int check_dir(struct mntent *mnt)
{
struct stat st;
int remounted = 0;
+ int failed = 0;
if (lstat(mnt->mnt_dir, &st) < 0)
die(2, _("Cannot stat mountpoint %s: %s\n"), mnt->mnt_dir, strerror(errno));
@@ -922,7 +926,7 @@ static void check_dir(struct mntent *mnt)
if (process_file(mnt, GRPQUOTA) < 0)
gcheck = 0;
if (!ucheck && !gcheck) /* Nothing to check? */
- return;
+ return 0;
if (!(flags & FL_NOREMOUNT)) {
/* Now we try to remount fs read-only to prevent races when scanning filesystem */
if (mount
@@ -932,12 +936,14 @@ static void check_dir(struct mntent *mnt)
printf(_("Cannot remount filesystem mounted on %s read-only. Counted values might not be right.\n"), mnt->mnt_dir);
if (!ask_yn(_("Should I continue"), 0)) {
printf(_("As you wish... Canceling check of this file.\n"));
+ failed = -1;
goto out;
}
}
else {
errstr(_("Cannot remount filesystem mounted on %s read-only so counted values might not be right.\n\
Please stop all programs writing to filesystem or use -m flag to force checking.\n"), mnt->mnt_dir);
+ failed = -1;
goto out;
}
}
@@ -949,7 +955,7 @@ start_scan:
debug(FL_VERBOSE, _("Scanning %s [%s] "), mnt->mnt_fsname, mnt->mnt_dir);
#if defined(EXT2_DIRECT)
if (!strcmp(mnt->mnt_type, MNTTYPE_EXT2) || !strcmp(mnt->mnt_type, MNTTYPE_EXT3)) {
- if (ext2_direct_scan(mnt->mnt_fsname) < 0)
+ if ((failed = ext2_direct_scan(mnt->mnt_fsname)) < 0)
goto out;
}
else {
@@ -958,19 +964,19 @@ start_scan:
#endif
if (flags & FL_VERYVERBOSE)
putchar('\n');
- if (scan_dir(mnt->mnt_dir) < 0)
+ if ((failed = scan_dir(mnt->mnt_dir)) < 0)
goto out;
}
dirs_done++;
if (flags & FL_VERBOSE || flags & FL_VERYVERBOSE)
fputs(_("done\n"), stdout);
if (ucheck) {
- sub_quota_file(mnt, USRQUOTA, USRQUOTA);
- sub_quota_file(mnt, USRQUOTA, GRPQUOTA);
+ failed |= sub_quota_file(mnt, USRQUOTA, USRQUOTA);
+ failed |= sub_quota_file(mnt, USRQUOTA, GRPQUOTA);
}
if (gcheck) {
- sub_quota_file(mnt, GRPQUOTA, USRQUOTA);
- sub_quota_file(mnt, GRPQUOTA, GRPQUOTA);
+ failed |= sub_quota_file(mnt, GRPQUOTA, USRQUOTA);
+ failed |= sub_quota_file(mnt, GRPQUOTA, GRPQUOTA);
}
debug(FL_DEBUG | FL_VERBOSE, _("Checked %d directories and %d files\n"), dirs_done,
files_done);
@@ -980,11 +986,12 @@ start_scan:
debug(FL_DEBUG, _("Filesystem remounted RW.\n"));
}
if (ucheck)
- dump_to_file(mnt, USRQUOTA);
+ failed |= dump_to_file(mnt, USRQUOTA);
if (gcheck)
- dump_to_file(mnt, GRPQUOTA);
+ failed |= dump_to_file(mnt, GRPQUOTA);
out:
remove_list();
+ return failed;
}
/* Detect quota format from filename of present files */
@@ -1083,11 +1090,13 @@ static int compatible_fs_qfmt(char *fstype, int fmt)
return !!strcmp(fstype, MNTTYPE_GFS2);
}
-static void check_all(void)
+/* Return 0 in case of success, non-zero otherwise. */
+static int check_all(void)
{
struct mntent *mnt;
int checked = 0;
static int warned;
+ int failed = 0;
if (init_mounts_scan((flags & FL_ALL) ? 0 : 1, &mntpoint, 0) < 0)
die(2, _("Cannot initialize mountpoint scan.\n"));
@@ -1114,6 +1123,7 @@ static void check_all(void)
if (cfmt == -1) {
errstr(_("Cannot guess format from filename on %s. Please specify format on commandline.\n"),
mnt->mnt_fsname);
+ failed = -1;
continue;
}
debug(FL_DEBUG, _("Detected quota format %s\n"), fmt2name(cfmt));
@@ -1150,25 +1160,30 @@ static void check_all(void)
}
checked++;
- check_dir(mnt);
+ failed |= check_dir(mnt);
}
end_mounts_scan();
- if (!checked && (!(flags & FL_ALL) || flags & (FL_VERBOSE | FL_DEBUG)))
+ if (!checked && (!(flags & FL_ALL) || flags & (FL_VERBOSE | FL_DEBUG))) {
errstr(_("Cannot find filesystem to check or filesystem not mounted with quota option.\n"));
+ failed = -1;
+ }
+ return failed;
}
int main(int argc, char **argv)
{
+ int failed;
+
gettexton();
progname = basename(argv[0]);
parse_options(argc, argv);
init_kernel_interface();
- check_all();
+ failed = check_all();
#ifdef DEBUG_MALLOC
errstr(_("Allocated %d bytes memory\nFree'd %d bytes\nLost %d bytes\n"),
malloc_mem, free_mem, malloc_mem - free_mem);
#endif
- return 0;
+ return (failed ? EXIT_FAILURE : EXIT_SUCCESS);
}
--
1.7.6

View File

@ -1,28 +0,0 @@
From a571f710b42f5ba76b5e577607b35a9076a76ba0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Mar 2011 17:52:33 +0100
Subject: [PATCH] Reverse setgrace condition
Original idea is to disallow remote grace setting. The condition
should be opposite. See
https://sourceforge.net/tracker/index.php?func=detail&aid=3202953&group_id=18136&atid=118136
---
setquota.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/setquota.c b/setquota.c
index fe29ec2..c012908 100644
--- a/setquota.c
+++ b/setquota.c
@@ -379,7 +379,7 @@ static int setgraces(struct quota_handle **handles)
int i, ret = 0;
for (i = 0; handles[i]; i++) {
- if (handles[i]->qh_ops->write_info) {
+ if (!handles[i]->qh_ops->write_info) {
errstr(_("Setting grace period on %s is not supported.\n"), handles[i]->qh_quotadev);
ret = -1;
continue;
--
1.7.4

View File

@ -1,25 +0,0 @@
From 5b9c30f584a4f36aceade621341c084b840dfaff Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Mon, 10 May 2010 07:10:57 +0000
Subject: [PATCH] We shouldn't pass NULL to XGETQSTAT quotactl since kernel either fails with
EFAULT or reads garbage from NULL address (which makes SELinux spit warnings).
(Jan Kara)
Petr Pisar: Changelog entry removed.
diff --git a/quotasys.c b/quotasys.c
index 307a359..5b6996c 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -754,7 +754,7 @@ void init_kernel_interface(void)
else {
fs_quota_stat_t dummy;
- if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
+ if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
}
/* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */
--
1.7.4.2

View File

@ -1,153 +0,0 @@
From 7f17e02d34e8157009d2603bfcea3bc619709eee Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Wed, 5 May 2010 15:17:09 +0000
Subject: [PATCH 1/2] GFS2 implements the XFS interface for setting and reporting the quota
information, and only allows state changes via remount. (Christoph Hellwig)
Petr Pisar: Changelog lines removed.
---
mntopt.h | 1 +
quotacheck.c | 4 +++-
quotaio.c | 3 ++-
quotaon.c | 8 ++++++--
quotasys.c | 12 +++++++++---
diff --git a/mntopt.h b/mntopt.h
index 90673fc..5117033 100644
--- a/mntopt.h
+++ b/mntopt.h
@@ -18,6 +18,7 @@
#define MNTTYPE_NFS4 "nfs4" /* NFSv4 filesystem */
#define MNTTYPE_MPFS "mpfs" /* EMC Celerra MPFS filesystem */
#define MNTTYPE_OCFS2 "ocfs2" /* Oracle Cluster filesystem */
+#define MNTTYPE_GFS2 "gfs2" /* Red Hat Global filesystem 2 */
/* mount options */
#define MNTOPT_NOQUOTA "noquota" /* don't enforce quota */
diff --git a/quotacheck.c b/quotacheck.c
index 41901f1..0e9bac9 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -1049,7 +1049,9 @@ static void check_all(void)
while ((mnt = get_next_mount())) {
if (flags & FL_ALL && flags & FL_NOROOT && !strcmp(mnt->mnt_dir, "/"))
continue;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) || nfs_fstype(mnt->mnt_type) ||
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
+ nfs_fstype(mnt->mnt_type) ||
meta_qf_fstype(mnt->mnt_type)) {
debug(FL_DEBUG | FL_VERBOSE, _("Skipping %s [%s]\n"), mnt->mnt_fsname, mnt->mnt_dir);
continue;
diff --git a/quotaio.c b/quotaio.c
index e857328..533b631 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -78,7 +78,8 @@ struct quota_handle *init_io(struct mntent *mnt, int type, int fmt, int flags)
goto out_handle;
}
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) { /* XFS filesystem? */
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) || /* XFS filesystem? */
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2)) { /* XFS filesystem? */
if (fmt != -1 && fmt != QF_XFS) { /* User wanted some other format? */
errstr(_("Only XFS quota format is allowed on XFS filesystem.\n"));
goto out_handle;
diff --git a/quotaon.c b/quotaon.c
index 813c021..1d1187b 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -273,7 +273,10 @@ static int newstate(struct mntent *mnt, int type, char *extra)
if (flags & FL_ALL)
sflags |= STATEFLAG_ALL;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) { /* XFS filesystem has special handling... */
+ if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2)) {
+ errstr(_("Cannot change state of GFS2 quota.\n"));
+ return 1;
+ } else if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) { /* XFS filesystem has special handling... */
if (!kern_qfmt_supp(QF_XFS)) {
errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
return 1;
@@ -329,7 +332,8 @@ static int print_state(struct mntent *mnt, int type)
{
int on = 0;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) {
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2)) {
if (kern_qfmt_supp(QF_XFS))
on = kern_quota_on(mnt->mnt_fsname, type, QF_XFS) != -1;
}
diff --git a/quotasys.c b/quotasys.c
index cce5787..0cc008c 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -91,7 +91,8 @@ static int correct_fstype(char *type)
!strcmp(type, MNTTYPE_NFS) ||
!strcmp(type, MNTTYPE_NFS4) ||
!strcmp(type, MNTTYPE_OCFS2) ||
- !strcmp(type, MNTTYPE_MPFS)) {
+ !strcmp(type, MNTTYPE_MPFS) ||
+ !strcmp(type, MNTTYPE_GFS2)) {
free(mtype);
return 1;
}
@@ -495,6 +496,8 @@ int hasquota(struct mntent *mnt, int type, int flags)
if (!correct_fstype(mnt->mnt_type) || hasmntopt(mnt, MNTOPT_NOQUOTA))
return 0;
+ if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2))
+ return 1;
if (!strcmp(mnt->mnt_type, MNTTYPE_XFS))
return hasxfsquota(mnt, type, flags);
if (nfs_fstype(mnt->mnt_type)) /* NFS always has quota or better there is no good way how to detect it */
@@ -652,11 +655,14 @@ add_entry:
goto add_entry;
break;
case QF_XFS:
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS))
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2))
goto add_entry;
break;
default:
- if (strcmp(mnt->mnt_type, MNTTYPE_XFS) && !nfs_fstype(mnt->mnt_type))
+ if (strcmp(mnt->mnt_type, MNTTYPE_XFS) &&
+ strcmp(mnt->mnt_type, MNTTYPE_GFS2) &&
+ !nfs_fstype(mnt->mnt_type))
goto add_entry;
break;
}
--
1.7.3.2
From f3553cfee6701f98e27a30318f8b759bcbbca370 Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Fri, 7 May 2010 15:45:52 +0000
Subject: [PATCH 2/2] Previous GFS2 patch was missing a hunk to properly detect whether
a GFS2 filesystem has quotas enabled. (Christoph Hellwig)
---
quotasys.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/quotasys.c b/quotasys.c
index 0cc008c..307a359 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -496,9 +496,8 @@ int hasquota(struct mntent *mnt, int type, int flags)
if (!correct_fstype(mnt->mnt_type) || hasmntopt(mnt, MNTOPT_NOQUOTA))
return 0;
- if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2))
- return 1;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS))
+ if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_XFS))
return hasxfsquota(mnt, type, flags);
if (nfs_fstype(mnt->mnt_type)) /* NFS always has quota or better there is no good way how to detect it */
return 1;
--
1.7.3.2

View File

@ -1,67 +0,0 @@
From b58944b582722dd3c56893eb4b6c8b8a0291201d Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Thu, 27 May 2010 13:12:57 +0000
Subject: [PATCH] * fix repquota to get latest quota info header (Jan Kara)
Petr Pisar: Changelog entry removed.
---
quotaio.c | 9 +++++++++
quotaio_v1.c | 5 -----
quotaio_v2.c | 5 -----
diff --git a/quotaio.c b/quotaio.c
index 533b631..ee8c48a 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -147,6 +147,15 @@ struct quota_handle *init_io(struct mntent *mnt, int type, int fmt, int flags)
}
}
if (!QIO_ENABLED(h) || flags & IOI_OPENFILE) { /* Need to open file? */
+ if (QIO_ENABLED(h)) { /* Kernel uses same file? */
+ unsigned int cmd =
+ (kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC;
+ if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
+ 0, NULL) < 0) {
+ die(4, _("Cannot sync quotas on device %s: %s\n"),
+ h->qh_quotadev, strerror(errno));
+ }
+ }
/* We still need to open file for operations like 'repquota' */
if ((fd = open(qfname, QIO_RO(h) ? O_RDONLY : O_RDWR)) < 0) {
errstr(_("Cannot open quotafile %s: %s\n"),
diff --git a/quotaio_v1.c b/quotaio_v1.c
index 0edbc16..1533ffc 100644
--- a/quotaio_v1.c
+++ b/quotaio_v1.c
@@ -348,11 +348,6 @@ static int v1_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct d
struct dquot *dquot = get_empty_dquot();
qid_t id = 0;
- if (QIO_ENABLED(h)) /* Kernel uses same file? */
- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
- h->qh_quotadev, 0, NULL) < 0)
- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
- strerror(errno));
memset(dquot, 0, sizeof(*dquot));
dquot->dq_h = h;
lseek(h->qh_fd, 0, SEEK_SET);
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 2e3c725..38440e7 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -484,11 +484,6 @@ static int v2_commit_dquot(struct dquot *dquot, int flags)
static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *, char *))
{
- if (QIO_ENABLED(h)) /* Kernel uses same file? */
- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
- h->qh_quotadev, 0, NULL) < 0)
- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
- strerror(errno));
return qtree_scan_dquots(h, process_dquot);
}
--
1.7.4

View File

@ -1,48 +0,0 @@
From e705c30d5f3758893eaa54be6867f5b6c50b8e24 Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Mon, 22 Feb 2010 20:43:59 +0000
Subject: [PATCH] * fixup typos in manpages (Michael Meskes)
---
Changelog | 3 +++
quota.1 | 2 +-
quotacheck.8 | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Changelog b/Changelog
index c2931a6..6fcb056 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,6 @@
+Changes in quota-tools from 3.17 to 4.00-pre2
+* fixup typos in manpages (Michael Meskes)
+
Changes in quota-tools from 3.17 to 4.00-pre1
* don't try to set inode flags when getting them failed (Michalski Wojciech)
* added liblber to the list of libraries needed for LDAP support (Michael Meskes)
diff --git a/quota.1 b/quota.1
index 705629c..0dd79a4 100644
--- a/quota.1
+++ b/quota.1
@@ -187,4 +187,4 @@ default filesystems
.BR quotaon (8),
.BR quota_nld (8),
.BR repquota (8),
-.DR warnquota (8)
+.BR warnquota (8)
diff --git a/quotacheck.8 b/quotacheck.8
index ed23e73..fe020f4 100644
--- a/quotacheck.8
+++ b/quotacheck.8
@@ -17,7 +17,7 @@ quotacheck \- scan a filesystem for disk usage, create, check and repair quota f
.B quotacheck
examines each filesystem, builds a table of current disk usage, and
compares this table against that recorded in the disk quota file for the
-filesystem (this step is ommitted if option
+filesystem (this step is omitted if option
.B -c
is specified). If any inconsistencies are detected, both the quota file
and the current system copy of the incorrect quotas are updated (the
--
1.7.4

View File

@ -1,29 +0,0 @@
From 940aecfcffe12b565ff0e06d1b6c838a86dfbdd0 Mon Sep 17 00:00:00 2001
From: jkar8572 <jkar8572>
Date: Tue, 4 May 2010 12:37:39 +0000
Subject: [PATCH] * avoid memory corruption of NULL address (Petr Pisar)
Petr Pisar: Upstream patch without Changelog lines.
diff --git a/quotasys.c b/quotasys.c
index 8df5e3b..cce5787 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -746,9 +746,12 @@ void init_kernel_interface(void)
kernel_qfmt_num = 0;
if (!stat("/proc/fs/xfs/stat", &st))
kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
- else
- if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, NULL) || (errno != EINVAL && errno != ENOSYS))
+ else {
+ fs_quota_stat_t dummy;
+
+ if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
+ }
/* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */
if (!stat("/proc/sys/fs/quota", &st) || errno != ENOENT) {
kernel_iface = IFACE_GENERIC;
--
1.7.3.2

View File

@ -5,7 +5,7 @@ Name: quota
Summary: System administration tools for monitoring users' disk usage
Epoch: 1
Version: 4.00
Release: 0.17.pre1%{?dist}
Release: 1%{?dist}
License: BSD and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Group: System Environment/Base
@ -14,77 +14,28 @@ Requires: quota-nls = %{epoch}:%{version}-%{release}
Conflicts: kernel < 2.4
BuildRequires: e2fsprogs-devel gettext tcp_wrappers-devel nss-devel
BuildRequires: openldap-devel openssl-devel dbus-devel libnl-devel
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}-pre1.tar.gz
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
Source1: quota_nld.init
Source2: quota_nld.sysconfig
# Part (LDAP comments) accepted into quota-4.00_pre2
# (378a64006bb1e818e84a1c77808563b802b028fa)
Patch0: quota-3.06-warnquota.patch
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa)
# Some of the lines have been superseded by other commits probably.
Patch0: quota-4.00-warnquota.patch
# 4.00_pre2 provides --enable-strip-binaries configure option defulting to yes
# TODO: Use the option instead of the patch
Patch1: quota-3.06-no-stripping.patch
Patch1: quota-4.00-no-stripping.patch
Patch2: quota-3.06-man-page.patch
Patch3: quota-3.06-pie.patch
Patch4: quota-3.13-wrong-ports.patch
# Included in upstream 4.00_pre2
Patch5: quota-3.16-helpoption.patch
# Included in upstream 4.00_pre2
Patch6: quota-3.16-quotaoffhelp.patch
Patch8: quota-3.17-ftbfs.patch
# Bug #528581, remove in upstream 4.00
Patch9: quota-4.00_pre1-quotactl_null_corruption.patch
# Included in upstream 4.00_pre2
Patch10: quota-4.00_pre1-add-gfs2-support.patch
# In upstream 4.00_pre2
Patch11: quota-4.00_pre1-Add-always-resolve-to-quota.1-manpage.patch
# In upstream 4.00_pre2
Patch12: quota-4.00_pre1-Document-always-resolve-at-edquota-and-setquota.patch
# Bug #667757
Patch13: quota-4.00_pre1-Make-RPC-block-factor-dynamic.patch
# Bug #668688, included in upstream 4.00_pre2
Patch14: quota-4.00_pre1-Check-whether-set-limits-fit-into-the-range-supporte.patch
# Bug #668691
Patch15: quota-4.00_pre1-Check-set-limits-fit-into-the-range-supported-by-RPC.patch
# In upstream 4.00_pre2
Patch16: quota-4.00_pre1-fixup-typos-in-manpages.patch
# In upstream 4.00_pre2
Patch17: quota-4.00_pre1-Added-reference-to-setquota-to-quota-1-manpage.patch
# In upstream 4.00_pre2
Patch18: quota-4.00_pre1-Correct-no-mixed-pathnames-documentation.patch
# Bug #634137, submitted to upstream
Patch19: quota-4.00_pre1-Store-PID-of-quota_nld.patch
# Bug #596794, in upstream 4.00_pre2
Patch20: quota-4.00_pre1-Add-quotasync-tool.patch
# Bug #596794, in upstream 4.00_pre2
Patch21: quota-4.00_pre1-Implement-quotacheck-for-GFS2.patch
# Bug 668688, in upstream 4.00_pre2
Patch22: quota-4.00_pre1-Initialize-vfsold-block-and-inode-value-boundries-fo.patch
# In upstream 4.00_pre2
Patch23: quota-4.00_pre1-Explain-meaning-of-the-second-column-in-repquota-out.patch
# In upstream 4.00_pre2
Patch24: quota-4.00_pre1-Make-RPC-handle-properly-host-names-with-colons.patch
# In upstream 4.00_pre2, SF#3195046
Patch25: quota-4.00_pre1-Do-not-use-real-domains-in-warnquota-example.patch
# In upstream 4.00_pre2, SF#3202953
Patch26: quota-4.00_pre1-Fix-synopsis-and-properly-report-errors-during-remot.patch
# In upstream 4.00_pre2, SF#3202953
Patch27: quota-4.00_pre1-Forbid-grace-time-setting-over-RPC.patch
# In upstream 4.00_pre2, SF#3202953
Patch28: quota-4.00_pre1-Reverse-setgrace-condition.patch
# In upstream 4.00_pre2, SF#3206267
Patch29: quota-4.00_pre1-Fix-ddquot-buffer-leak.patch
# In upstream 4.00_pre2, bug #689458
Patch30: quota-4.00_pre1-fix-repquota-to-get-latest-quota-info-header.patch
# In upstream 4.00_pre2, bug #695409
Patch31: quota-4.00_pre1-Initialize-v2r1-ddquot-padding-in-dump.patch
# In upstream 4.00_pre2
Patch32: quota-4.00_pre1-We-shouldn-t-pass-NULL-to-XGETQSTAT-quotactl-since-k.patch
# In upstream 4.00_pre2 (SF#3300978), bug #703567
Patch33: quota-4.00_pre1-Make-dirname-static.patch
# In upstream 4.00_pre2 (SF#3347047), bug #717982
Patch34: quota-4.00_pre1-Report-quotacheck-failures-by-return-code.patch
# In upstream 4.00_pre2 (SF#3347047), bug #717982
Patch35: quota-4.00_pre1-get_qf_name-does-not-check-quota-file-presence.patch
# Can be squashed with quota-4.00-warnquota.patch
Patch25: quota-4.00-Do-not-use-real-domains-in-warnquota-example.patch
# In upstream after 4.00 (SF#3393151), bug #731622
Patch36: quota-4.00-Do-not-report-missing-utmp-record-to-syslog.patch
@ -163,36 +114,11 @@ Linux/UNIX environment.
%patch3 -p1
%endif
%patch4 -p1
%patch5 -p1
%patch6 -p1 -b .usage
%patch8 -p1
%patch9 -p1 -b .quotactl_null_corruption
%patch10 -p1 -b .gfs2
%patch11 -p1 -b .document_always_resolve_quota
%patch12 -p1 -b .document_always_resolve_setquota
%patch13 -p1 -b .rpc_block_factor_dynamic
%patch14 -p1 -b .check_set_limits
%patch15 -p1 -b .check_set_limits_rpc
%patch16 -p1 -b .typos_in_manpages
%patch17 -p1 -b .reference_to_setquota_doc
%patch18 -p1 -b .mixed_pathnames_doc
%patch19 -p1 -b .store_pid
%patch20 -p1 -b .add_quotasync
%patch21 -p1 -b .gfs2_quotacheck
%patch22 -p1 -b .inizialize_vfsold_boundries
%patch23 -p1 -b .explain_second_column_of_repquota
%patch24 -p1 -b .hostnames_with_columns
%patch25 -p1 -b .warnquota_domains
%patch26 -p1 -b .fix_grace_synopsis
%patch27 -p1 -b .forbid_rpc_grace_time
%patch28 -p1 -b .reverse_setgrace_condition
%patch29 -p1 -b .fix_ddquot_leak
%patch30 -p1 -b .repquota_latest_info
%patch31 -p1 -b .initizalize_ddquot_paddding
%patch32 -p1 -b .do_not_pass_null_to_XGETQSTAT
%patch33 -p1 -b .static_dirname
%patch34 -p1 -b .report_quotacheck_failures
%patch35 -p1 -b .improve_quotacheck_message
%patch36 -p1 -b .suppress_missing_utmp
# quotactl(2) moved into `man-pages' package (bug #640590)
rm -f quotactl.2
@ -305,6 +231,9 @@ fi
%changelog
* Tue Aug 23 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-1
- 4.00 bump
* Thu Aug 18 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-0.17.pre1
- Do not report missing utmp record to syslog (bug #731622)

View File

@ -1 +1 @@
ef9d66e8a968ecffd2d9df648fa8ada2 quota-4.00-pre1.tar.gz
975f587ff761a60ac25dbe6c00865925 quota-4.00.tar.gz