[quota/f13/master] Use /proc/mounts for mountpoint scanning
Petr Pisar
ppisar at fedoraproject.org
Thu Nov 25 17:19:09 UTC 2010
commit 5a1799ea5eef0d07ba9fb97592b47a3eedd73bfd
Author: Petr Písař <ppisar at redhat.com>
Date: Thu Nov 25 17:44:46 2010 +0100
Use /proc/mounts for mountpoint scanning
This is because /etc/mtab gets damaged with mount(8) on remount with
usrquota/noquota cycle.
...7-use-proc-mounts-for-mountpoint-scanning.patch | 82 ++++++++++++++++++++
quota.spec | 13 +++-
2 files changed, 94 insertions(+), 1 deletions(-)
---
diff --git a/quota-3.17-use-proc-mounts-for-mountpoint-scanning.patch b/quota-3.17-use-proc-mounts-for-mountpoint-scanning.patch
new file mode 100644
index 0000000..f85bbc7
--- /dev/null
+++ b/quota-3.17-use-proc-mounts-for-mountpoint-scanning.patch
@@ -0,0 +1,82 @@
+From 6a3bbccab6f8262912bdc2cf5bff77553c547e30 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 25 Nov 2010 15:48:27 +0100
+Subject: [PATCH] Use /proc/mounts for mountpoint scanning
+
+This is back-port of relevant part of upstream commit
+d271d0a329a5b3e99f4ad209b5270a8648739ff0.
+
+Series of switching quota on/off by mount(8) command (-o remount,noquota
+-o remount,usrquota,grpquota) damages /etc/mtab content
+(usrquota,grpquota,noquota,usrquota,grpquota) and that makes quota to
+believe the mount point has quota off.
+
+See <https://bugzilla.redhat.com/show_bug.cgi?id=623656> for more details.
+---
+ configure.in | 7 +++++++
+ quotasys.c | 23 +++++++++++++----------
+ 2 files changed, 20 insertions(+), 10 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index c119c6c..58c1c62 100644
+--- a/configure.in
++++ b/configure.in
+@@ -205,6 +205,10 @@ AC_ARG_ENABLE(rootsbin,
+ [ --enable-rootsbin=[yes/no] Use /sbin for some important binaries regardless $prefix [default=no].],
+ ,
+ enable_rootsbin="no")
++AC_ARG_ENABLE(proc-mounts,
++ [ --enable-proc-mounts=[path] Use alternate file instead of /etc/mtab [default=/proc/mounts].],
++ ,
++ enable_proc_mounts="/proc/mounts")
+
+ if test "$enable_altformat" = "yes" ; then
+ CFLAGS="-DALT_FORMAT $CFLAGS"
+@@ -233,6 +237,9 @@ if test "$enable_nls" = "yes" ; then
+ CFLAGS="-D__GETTEXT__ $CFLAGS"
+ INSTMO="inst_mo"
+ fi
++if test -n "$enable_proc_mounts" ; then
++ CFLAGS="-DALT_MTAB=\\\"$enable_proc_mounts\\\" $CFLAGS"
++fi
+ if test "$enable_rootsbin" = "yes" ; then
+ ROOTSBIN="/sbin"
+ else
+diff --git a/quotasys.c b/quotasys.c
+index 86802c3..dbe9d1c 100644
+--- a/quotasys.c
++++ b/quotasys.c
+@@ -913,17 +913,20 @@ static int cache_mnt_table(int flags)
+ int autofsdircnt = 0;
+ char autofsdir[AUTOFS_DIR_MAX][PATH_MAX];
+
+- if (!(mntf = setmntent(_PATH_MOUNTED, "r"))) {
+- if (errno != ENOENT) {
+- errstr(_("Cannot open %s: %s\n"), _PATH_MOUNTED, strerror(errno));
+- return -1;
+- }
+- else /* Fallback on fstab when mtab not available */
+- if (!(mntf = setmntent(_PATH_MNTTAB, "r"))) {
+- errstr(_("Cannot open %s: %s\n"), _PATH_MNTTAB, strerror(errno));
+- return -1;
+- }
++#ifdef ALT_MTAB
++ mntf = setmntent(ALT_MTAB, "r");
++ if (mntf)
++ goto alloc;
++#endif
++ mntf = setmntent(_PATH_MOUNTED, "r");
++ if (mntf)
++ goto alloc;
++ /* Fallback to fstab when mtab not available */
++ if (!(mntf = setmntent(_PATH_MNTTAB, "r"))) {
++ errstr(_("Cannot open any file with mount points.\n"));
++ return -1;
+ }
++alloc:
+ mnt_entries = smalloc(sizeof(struct mount_entry) * ALLOC_ENTRIES_NUM);
+ mnt_entries_cnt = 0;
+ allocated += ALLOC_ENTRIES_NUM;
+--
+1.7.3.2
+
diff --git a/quota.spec b/quota.spec
index 6a6c03b..cffcb2a 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: 3.17
-Release: 11%{?dist}
+Release: 12%{?dist}
License: BSD and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Group: System Environment/Base
@@ -14,6 +14,7 @@ Requires: initscripts >= 6.38 tcp_wrappers e2fsprogs
Conflicts: kernel < 2.4
BuildRequires: e2fsprogs-devel gettext tcp_wrappers-devel nss-devel
BuildRequires: openldap-devel openssl-devel dbus-devel libnl-devel
+BuildRequires: autoconf
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
Patch0: quota-3.06-warnquota.patch
Patch1: quota-3.06-no-stripping.patch
@@ -28,6 +29,8 @@ Patch8: quota-3.17-ftbfs.patch
Patch9: quota-3.17-quotactl_null_corruption.patch
# Included in upstream 4.00_pre2
Patch10: quota-3.17-add-gfs2-support.patch
+# Bug #657379, included in upstream 4.00_pre1
+Patch11: quota-3.17-use-proc-mounts-for-mountpoint-scanning.patch
%description
The quota package contains system administration tools for monitoring
@@ -61,6 +64,7 @@ on remote machines.
%patch8 -p1
%patch9 -p1 -b .quotactl_null_corruption
%patch10 -p1 -b .gfs2
+%patch11 -p1 -b .use_proc_mounts
#fix typos/mistakes in localized documentation
for pofile in $(find ./po/*.p*)
@@ -68,6 +72,10 @@ do
sed -i 's/editting/editing/' "$pofile"
done
+# Regenerate configure (Patch10)
+autoconf
+
+
%build
%configure \
--enable-ldapmail=try \
@@ -123,6 +131,9 @@ rm -rf %{buildroot}
%attr(0644,root,root) %{_mandir}/man3/*
%changelog
+* Thu Nov 25 2010 Petr Pisar <ppisar at redhat.com> - 1:3.17-12
+- Use /proc/mounts for mountpoint scanning (#657379)
+
* Tue May 11 2010 Petr Pisar <ppisar at redhat.com> 1:3.17-11
- Add GFS2 support
More information about the scm-commits
mailing list