[quota/f15/master] Fix repquota to get latest quota info header
Petr Pisar
ppisar at fedoraproject.org
Mon Mar 21 15:35:22 UTC 2011
commit 375919f595079b7c80998e4a152f2d81f48012f0
Author: Petr Písař <ppisar at redhat.com>
Date: Mon Mar 21 16:15:49 2011 +0100
Fix repquota to get latest quota info header
repquota must synchronize quota files before reading headers from them.
Otherwise headers will mismatch following data.
...-repquota-to-get-latest-quota-info-header.patch | 67 ++++++++++++++++++++
quota.spec | 8 ++-
2 files changed, 74 insertions(+), 1 deletions(-)
---
diff --git a/quota-4.00_pre1-fix-repquota-to-get-latest-quota-info-header.patch b/quota-4.00_pre1-fix-repquota-to-get-latest-quota-info-header.patch
new file mode 100644
index 0000000..4a4023f
--- /dev/null
+++ b/quota-4.00_pre1-fix-repquota-to-get-latest-quota-info-header.patch
@@ -0,0 +1,67 @@
+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
+
diff --git a/quota.spec b/quota.spec
index 35198d1..9da0405 100644
--- a/quota.spec
+++ b/quota.spec
@@ -5,7 +5,7 @@ Name: quota
Summary: System administration tools for monitoring users' disk usage
Epoch: 1
Version: 4.00
-Release: 0.9.pre1%{?dist}
+Release: 0.10.pre1%{?dist}
License: BSD and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Group: System Environment/Base
@@ -62,6 +62,8 @@ Patch21: quota-4.00_pre1-Implement-quotacheck-for-GFS2.patch
Patch22: quota-4.00_pre1-Initialize-vfsold-block-and-inode-value-boundries-fo.patch
# Bug #684189, submitted to upstream, SF#3206267
Patch23: quota-4.00_pre1-Fix-ddquot-buffer-leak.patch
+# In upstream 4.00_pre2, bug #689458
+Patch24: quota-4.00_pre1-fix-repquota-to-get-latest-quota-info-header.patch
%description
@@ -156,6 +158,7 @@ Linux/UNIX environment.
%patch21 -p1 -b .gfs2_quotacheck
%patch22 -p1 -b .inizialize_vfsold_boundries
%patch23 -p1 -b .fix_ddquot_leak
+%patch24 -p1 -b .repquota_latest_info.patch
# quotactl(2) moved into `man-pages' package (bug #640590)
rm -f quotactl.2
# remove VCS files
@@ -278,6 +281,9 @@ rm -rf %{buildroot}
%changelog
+* Mon Mar 21 2011 Petr Pisar <ppisar at redhat.com> - 1:4.00-0.10.pre1
+- Fix repquota to get latest quota info header (bug #689458)
+
* Fri Mar 11 2011 Petr Pisar <ppisar at redhat.com> - 1:4.00-0.9.pre1
- Fix ddquot buffer leak (bug #684189)
More information about the scm-commits
mailing list