4.01 bump

This commit is contained in:
Petr Písař 2012-09-07 14:35:38 +02:00
parent 27f3ba67dc
commit 442211bda2
11 changed files with 22 additions and 426 deletions

1
.gitignore vendored
View File

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

3
.rpmlint Normal file
View File

@ -0,0 +1,3 @@
from Config import *
addFilter("summary-not-capitalized C quota_nld");
addFilter("spelling-error .* (cron|netlink)");

View File

@ -1,36 +0,0 @@
From 7d2ac8097d65c6698124abd2dda25bffd8590aa7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 17 Aug 2011 16:16:12 +0200
Subject: [PATCH] Do not report missing utmp record to syslog
If no utmp record can be found there is obviously nobody to read error
message about missing TTY in sytem log in real time. Moreover the log
is usually illegible for normal user. So it's pointless to log this
fact there for user's sake. warnquota can be used instead.
Signed-off-by: Jan Kara <jack@suse.cz>
---
quota_nld.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/quota_nld.c b/quota_nld.c
index de9504e..5a53b7e 100644
--- a/quota_nld.c
+++ b/quota_nld.c
@@ -264,7 +264,12 @@ static void write_console_warning(struct quota_warning *warn)
}
}
if (!max_atime) {
- errstr(_("Failed to find tty of user %llu to report warning to.\n"), (unsigned long long)warn->caused_id);
+ /*
+ * This can happen quite easily so don't spam syslog with
+ * the error
+ */
+ if (flags & FL_NODAEMON)
+ errstr(_("Failed to find tty of user %llu to report warning to.\n"), (unsigned long long)warn->caused_id);
return;
}
fd = open(max_dev, O_WRONLY);
--
1.7.6

View File

@ -1,35 +0,0 @@
Fix editting more users with edquota
Back-ported for 4.00 from upstream commit:
From e7cdf879468501b1be6c3ab9add1c9ec056093ab Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 23 May 2012 15:29:31 +0200
Subject: [PATCH 1/2] edquota: Fix editting of more users
We reopened temporary file with editted quota limits in O_RDONLY mode after
user has edited the limits. This is problematic when edquota is called to
edit more users because then we cannot write limits for the next user to
the file. So reopen the file O_RDWR mode.
diff --git a/edquota.c b/edquota.c
index ef9fc9b..f433417 100644
--- a/edquota.c
+++ b/edquota.c
@@ -333,7 +333,11 @@ int main(int argc, char **argv)
continue;
}
close(tmpfd);
- if ((tmpfd = open(tmpfil, O_RDONLY)) < 0)
+ /*
+ * Open in rw mode because we can reuse the file for
+ * editting next user as well.
+ */
+ if ((tmpfd = open(tmpfil, O_RDWR)) < 0)
die(1, _("Cannot reopen!"));
if (readprivs(curprivs, tmpfd) < 0) {
errstr(_("Cannot read quotas from file.\n"));
--
1.7.7.6

View File

@ -1,35 +0,0 @@
From 6ba6546dd167297cb9ed69d0257ee245b0faea47 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 8 Jun 2012 11:11:20 +0200
Subject: [PATCH 2/2] repquota: Fix reporting for XFS
Conversion to generic quota scanning introduced a bug for XFS where we
stopped scanning after quotactl reported first error. quotactl for XFS
however reports ENOENT when it has nothing to report for a particular user
/ group and we shouldn't stop scanning after that. We tried to test for this
but the test was wrong. Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotaio_xfs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 2e879e6..903c03e 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -183,9 +183,9 @@ static int xfs_get_dquot(struct dquot *dq)
memset(&d, 0, sizeof(d));
ret = quotactl(qcmd, dq->dq_h->qh_quotadev, dq->dq_id, (void *)&d);
if (ret < 0) {
- if (ret == -ENOENT)
+ if (errno == ENOENT)
return 0;
- return ret;
+ return -1;
}
xfs_kern2utildqblk(&dq->dq_dqb, &d);
return 0;
--
1.7.7.6

View File

@ -1,85 +0,0 @@
From 34c4eae2eb493d4de97f5f9e784d4efc73b9f886 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 7 Jan 2011 13:53:13 +0100
Subject: [PATCH] Check set limits fit into the range supported by RPC transport
E.g. setquota -r root $((2**32)) 1000 10 10 /mnt/nfs/12tb
clamped the values into 32 bits and RPC server got 0 soft block limit.
This fixes simalar bug spotted in 8a4dc3612c6c170c05e5eef68dd3555baeb341c1
(Check whether set limits fit into the range supported by quota format.)
---
quotaio.c | 2 ++
quotaio_rpc.c | 18 ++++++++++++++++++
rquota_client.c | 5 +++++
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/quotaio.c b/quotaio.c
index 21881fc..3b74680 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -69,6 +69,8 @@ struct quota_handle *init_io(struct mntent *mnt, int type, int fmt, int flags)
h->qh_fd = -1;
h->qh_fmt = QF_RPC;
h->qh_ops = &quotafile_ops_rpc;
+ memset(&h->qh_info, 0, sizeof(h->qh_info));
+ h->qh_ops->init_io(h);
return h;
#else
errstr(_("RPC quota format not compiled.\n"));
diff --git a/quotaio_rpc.c b/quotaio_rpc.c
index 14fe410..2e0b493 100644
--- a/quotaio_rpc.c
+++ b/quotaio_rpc.c
@@ -15,14 +15,32 @@
#include "rquota_client.h"
#include "pot.h"
+static int rpc_init_io(struct quota_handle *h);
static struct dquot *rpc_read_dquot(struct quota_handle *h, qid_t id);
static int rpc_commit_dquot(struct dquot *dquot, int flags);
struct quotafile_ops quotafile_ops_rpc = {
+init_io: rpc_init_io,
read_dquot: rpc_read_dquot,
commit_dquot: rpc_commit_dquot
};
+/*
+ * Define maximal values RPC client can transmit to server.
+ */
+static int rpc_init_io(struct quota_handle *h)
+{
+#ifdef RPC
+ 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 = (~(uint32_t)0) << QUOTABLOCK_BITS;
+ h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
+ return 0;
+#else
+ return -1;
+#endif
+}
+
/*
* Read a dqblk struct from RPC server - just wrapper function.
*/
diff --git a/rquota_client.c b/rquota_client.c
index cc1d623..4aad4b9 100644
--- a/rquota_client.c
+++ b/rquota_client.c
@@ -242,6 +242,11 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
char *fsname_tmp, *host, *pathname;
struct timeval timeout = { 2, 0 };
+ /* RPC limits values to 32b variables. Prevent value wrapping. */
+ if (check_dquot_range(dquot) < 0) {
+ return -ERANGE;
+ }
+
/*
* Convert host:pathname to seperate host and pathname.
*/
--
1.7.3.4

View File

@ -1,82 +0,0 @@
From 7e1c5c8074e5d83cfda5b66140c177954b836118 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 6 Jan 2011 17:59:27 +0100
Subject: [PATCH] Make RPC block factor dynamic
Former static factor (RPC_DQBLK_SIZE_BITS) had problem to carry values
bigger than hard-coded limit (2^(32 + RPC_DQBLK_SIZE_BITS) - 1).
This patch makes the factor dynamic. It selects best value to prevent
overflow (XDR has 32b variables, some file system support 64b quotas)
and to achieve highest possible precision.
The client site uses the factor carried via RPC correctly.
There is similar problem with setquota. This patch does not address it,
however it can be easily resused and fixed.
---
rquota_server.c | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/rquota_server.c b/rquota_server.c
index 0e83689..cff6191 100644
--- a/rquota_server.c
+++ b/rquota_server.c
@@ -91,17 +91,42 @@ static inline void servnet2utildqblk(struct util_dqblk *u, sq_dqblk * n)
u->dqb_itime = 0;
}
+/* XDR transports 32b variables exactly. Find smallest needed shift to fit
+ * 64b variable into into 32 bits and to preserve precision as high as
+ * possible. */
+static int find_block_shift(qsize_t hard, qsize_t soft, qsize_t cur)
+{
+ int shift;
+ qsize_t value;
+
+ value = (hard > soft) ? hard : soft;
+ for (shift = QUOTABLOCK_BITS; value; shift++) value >>= 1;
+
+ cur >>= shift;
+ for (; cur; shift++) cur >>= 1;
+
+ shift -= 32;
+ if (shift < 0) shift = 0;
+
+ return shift;
+}
+
static inline void servutil2netdqblk(struct rquota *n, struct util_dqblk *u)
{
time_t now;
+ int shift;
- time(&now);
- n->rq_bhardlimit = (u->dqb_bhardlimit << QUOTABLOCK_BITS) >> RPC_DQBLK_SIZE_BITS;
- n->rq_bsoftlimit = (u->dqb_bsoftlimit << QUOTABLOCK_BITS) >> RPC_DQBLK_SIZE_BITS;
+ shift = find_block_shift(u->dqb_bhardlimit, u->dqb_bsoftlimit,
+ u->dqb_curspace);
+ n->rq_bsize = 1 << shift;
+ n->rq_bhardlimit = (u->dqb_bhardlimit << QUOTABLOCK_BITS) >> shift;
+ n->rq_bsoftlimit = (u->dqb_bsoftlimit << QUOTABLOCK_BITS) >> shift;
n->rq_fhardlimit = u->dqb_ihardlimit;
n->rq_fsoftlimit = u->dqb_isoftlimit;
- n->rq_curblocks = (u->dqb_curspace + RPC_DQBLK_SIZE - 1) >> RPC_DQBLK_SIZE_BITS;
+ n->rq_curblocks = (u->dqb_curspace + n->rq_bsize - 1) >> shift;
n->rq_curfiles = u->dqb_curinodes;
+
+ time(&now);
if (u->dqb_btime)
n->rq_btimeleft = u->dqb_btime - now;
else
@@ -258,7 +283,6 @@ getquota_rslt *getquotainfo(int lflags, caddr_t * argp, struct svc_req * rqstp)
}
result.status = Q_NOQUOTA;
- result.getquota_rslt_u.gqr_rquota.rq_bsize = RPC_DQBLK_SIZE;
if (init_mounts_scan(1, &pathp, MS_QUIET | MS_NO_MNTPOINT | MS_NFS_ALL | ((flags & FL_AUTOFS) ? 0 : MS_NO_AUTOFS)) < 0)
goto out;
--
1.7.3.4

View File

@ -1,121 +0,0 @@
From d371c4769dac5d84fa2089299efd77b5341c5079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 3 Feb 2011 17:57:09 +0100
Subject: [PATCH] Store PID of quota_nld
If quota_nld is run as daemon, daemon's PID will be stored into
/var/run/${PROGNAME}.pid file and it will be deleted on receiving SIGTERM
just before program termination.
PID file is used by init scripts to find and kill forked daemon.
---
quota_nld.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/quota_nld.c b/quota_nld.c
index 538702d..600bdf1 100644
--- a/quota_nld.c
+++ b/quota_nld.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <fcntl.h>
#include <limits.h>
+#include <signal.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
@@ -369,6 +370,83 @@ static void run(struct nl_handle *nhandle)
}
}
+/* Build file name (absolute path) to PID file of this daemon.
+ * The returned name is allocated on heap. */
+static char *build_pid_file_name(void)
+{
+ char *pid_name = NULL;
+ if (!progname) {
+ errstr(_("Undefined program name.\n"));
+ return NULL;
+ }
+ pid_name = malloc(9 + strlen(progname) + 4 + 1);
+ if (!pid_name) {
+ errstr(_("Not enough memory to build PID file name.\n"));
+ return NULL;
+ }
+ sprintf(pid_name, "/var/run/%s.pid", progname);
+ return pid_name;
+}
+
+/* Store daemon's PID to file */
+static int store_pid(void)
+{
+ FILE *pid_file;
+ char *pid_name;
+
+ pid_name = build_pid_file_name();
+ if (!pid_name) return -1;
+
+ pid_file = fopen(pid_name, "w");
+ if (!pid_file) {
+ errstr(_("Could not open PID file '%s': %s\n"),
+ pid_name, strerror(errno));
+ free(pid_name);
+ return -1;
+ }
+ if (0 > fprintf(pid_file, "%jd\n", (intmax_t)getpid())) {
+ errstr(_("Could not write daemon's PID into '%s'.\n"),
+ pid_name);
+ fclose(pid_file);
+ free(pid_name);
+ return -1;
+ }
+ if (fclose(pid_file)) {
+ errstr(_("Could not close PID file '%s'.\n"), pid_name);
+ free(pid_name);
+ return -1;
+ }
+
+ free(pid_name);
+ return 0;
+}
+
+/* Handler for SIGTERM to remove PID file */
+static void remove_pid(int signal)
+{
+ char *pid_name;
+
+ pid_name = build_pid_file_name();
+ if (pid_name) {
+ unlink(pid_name);
+ free(pid_name);
+ }
+ exit(EXIT_SUCCESS);
+}
+
+/* Store daemon's PID into file and register its removal on SIGTERM */
+static int use_pid_file(void)
+{
+ struct sigaction term_action;
+
+ term_action.sa_handler = remove_pid;
+ term_action.sa_flags = 0;
+ if (sigaction(SIGTERM, &term_action, NULL))
+ errstr(_("Could not register PID file removal on SIGTERM.\n"));
+ if (store_pid())
+ errstr(_("Could not store my PID %jd.\n"), (intmax_t )getpid());
+}
+
int main(int argc, char **argv)
{
struct nl_handle *nhandle;
@@ -383,6 +461,7 @@ int main(int argc, char **argv)
if (!(flags & FL_NODAEMON)) {
use_syslog();
daemon(0, 0);
+ use_pid_file();
}
run(nhandle);
return 0;
--
1.7.4

View File

@ -1,4 +1,4 @@
From 500d609f7ed11ed385651d09c2e3f56b092f4ef2 Mon Sep 17 00:00:00 2001
From d2f7a6be1526a6f46cbf37aa27587a51e4d5990f 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
@ -7,12 +7,12 @@ Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
accepted by upstream (we had root@... addresses and more enterprise
wordings usually there).
---
warnquota.c | 2 +-
warnquota.conf | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
warnquota.c | 2 +-
warnquota.conf | 17 ++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 2ca286f..3b78647 100644
index 08827f2..c7ca6f2 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -806,7 +806,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
@ -25,14 +25,15 @@ index 2ca286f..3b78647 100644
else
config->use_ldap_mail = 0;
diff --git a/warnquota.conf b/warnquota.conf
index 8801a88..77f6a75 100644
index 2a72b78..77f6a75 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -4,16 +4,16 @@
@@ -4,17 +4,16 @@
# and even blank lines
# values can be quoted:
-MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
-#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
-MAIL_CMD = "/bin/echo"
-FROM = "bas@example.com"
+MAIL_CMD = "/usr/sbin/sendmail -t"
+FROM = "root@example.com"
@ -50,7 +51,7 @@ index 8801a88..77f6a75 100644
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-4444"
@@ -22,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.
@ -66,5 +67,5 @@ index 8801a88..77f6a75 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.6
1.7.11.4

View File

@ -4,8 +4,8 @@
Name: quota
Summary: System administration tools for monitoring users' disk usage
Epoch: 1
Version: 4.00
Release: 6%{?dist}
Version: 4.01
Release: 1%{?dist}
License: BSD and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Group: System Environment/Base
@ -20,22 +20,10 @@ Source1: quota_nld.service
Source2: quota_nld.sysconfig
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa)
# Some of the lines have been superseded by other commits probably.
Patch0: quota-4.00-warnquota.patch
Patch0: quota-4.01-warnquota.patch
Patch1: quota-3.06-man-page.patch
Patch2: quota-3.06-pie.patch
Patch3: quota-3.13-wrong-ports.patch
# Bug #667757, in upstream after 4.00 (SF#3152423)
Patch4: quota-4.00_pre1-Make-RPC-block-factor-dynamic.patch
# Bug #668691, in upstream after 4.00 (SF#3152423)
Patch5: quota-4.00_pre1-Check-set-limits-fit-into-the-range-supported-by-RPC.patch
# Bug #634137, in upstream after 4.00 (SF#3171791)
Patch6: quota-4.00_pre1-Store-PID-of-quota_nld.patch
# In upstream after 4.00 (SF#3393151), bug #731622
Patch7: quota-4.00-Do-not-report-missing-utmp-record-to-syslog.patch
# In upstream after 4.00
Patch8: quota-4.00-edquota-Fix-editting-of-more-users.patch
# Bug #837341, in upstream after 4.00
Patch9: quota-4.00-repquota-Fix-reporting-for-XFS.patch
%description
@ -111,12 +99,6 @@ Linux/UNIX environment.
%patch2 -p1
%endif
%patch3 -p1
%patch4 -p1 -b .rpc_block_factor_dynamic
%patch5 -p1 -b .check_set_limits_rpc
%patch6 -p1 -b .store_pid
%patch7 -p1 -b .suppress_missing_utmp
%patch8 -p1 -b .edquota_more_users
%patch9 -p1 -b .repqouta_xfs
#fix typos/mistakes in localized documentation
for pofile in $(find ./po/*.p*)
@ -231,6 +213,9 @@ echo ' systemd-sysv-convert --apply quota_nld'
%changelog
* Fri Sep 07 2012 Petr Pisar <ppisar@redhat.com> - 1:4.01-1
- 4.01 bump
* Wed Aug 22 2012 Petr Pisar <ppisar@redhat.com> - 1:4.00-6
- Modernize systemd scriptlets (bug #850288)

View File

@ -1 +1 @@
975f587ff761a60ac25dbe6c00865925 quota-4.00.tar.gz
5c2c31e321d2e1322ce12d69ae5c66d6 quota-4.01.tar.gz