summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2008-03-13 14:49:33 +0000
committerjkar8572 <jkar8572>2008-03-13 14:49:33 +0000
commit76939b266a7ea73cdc0f8625aa6039fe57699d60 (patch)
treef99df6db3c726c03386fffa8e2e4e8a6a5411dc6
parentcd94d5df4349923a36cac89a80f78d388dde61c4 (diff)
* added information message about journaled quota to quotacheck (Jan Kara, Alex Tomas)
-rw-r--r--Changelog1
-rw-r--r--quotacheck.c34
-rw-r--r--quotaon.c3
3 files changed, 36 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index 5ec0e5d..d3f5153 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
Changes in quota-tools from 3.15 to 3.16
+* added information message about journaled quota to quotacheck (Jan Kara, Alex Tomas)
* added pointers to quota_nld and warnquota to some manpages (Jan Kara)
* ported quota_nld to libnl-1.1 (Jan Kara)
* let setquota batch mode accept comments and blank lines, add -c option (Jacky Bruno, Jan Kara)
diff --git a/quotacheck.c b/quotacheck.c
index 8b46819..9e7d679 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -8,7 +8,7 @@
* New quota format implementation - Jan Kara <jack@suse.cz> - Sponsored by SuSE CR
*/
-#ident "$Id: quotacheck.c,v 1.53 2007/02/21 13:51:25 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.54 2008/03/13 14:49:33 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -26,6 +26,7 @@
#include <sys/statfs.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
+#include <sys/utsname.h>
#if defined(HAVE_EXT2_INCLUDE)
#include <linux/types.h>
@@ -1028,6 +1029,7 @@ static void check_all(void)
{
struct mntent *mnt;
int checked = 0;
+ static int warned;
if (init_mounts_scan((flags & FL_ALL) ? 0 : 1, &mntpoint, 0) < 0)
die(2, _("Cannot initialize mountpoint scan.\n"));
@@ -1057,6 +1059,36 @@ static void check_all(void)
}
debug(FL_DEBUG, _("Detected quota format %s\n"), fmt2name(cfmt));
}
+
+ if (flags & FL_VERBOSE && !hasmntopt(mnt, MNTOPT_USRJQUOTA) &&
+ !hasmntopt(mnt, MNTOPT_GRPJQUOTA) && !warned &&
+ (!strcmp(mnt->mnt_type, MNTTYPE_EXT3) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_EXT4) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_REISER))) {
+ struct utsname stats;
+
+ /* Parse Linux kernel version and issue warning if not using
+ * journaled quotas. */
+ warned = 1;
+ if (uname(&stats) < 0)
+ errstr(_("Cannot get system info: %s\n"),
+ strerror(errno));
+ else if (!strcmp(stats.sysname, "Linux")) {
+ int v;
+ char *errch;
+
+ v = strtol(stats.release, &errch, 10);
+ if (*errch == '.' && v >= 2) {
+ v = strtol(errch + 1, &errch, 10);
+ if (*errch == '.' && v >= 6) {
+ v = strtol(errch + 1, &errch, 10);
+ if (v >= 11)
+ errstr(_("Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.\n"));
+ }
+ }
+ }
+ }
+
checked++;
check_dir(mnt);
}
diff --git a/quotaon.c b/quotaon.c
index 024a3ea..3f5ac86 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaon.c,v 1.24 2007/09/18 12:23:54 jkar8572 Exp $"
+#ident "$Id: quotaon.c,v 1.25 2008/03/13 14:49:33 jkar8572 Exp $"
/*
* Turn quota on/off for a filesystem.
@@ -319,6 +319,7 @@ int v2_newstate(struct mntent *mnt, int type, char *file, int flags)
if (!dev)
return 1;
+
if (hasquota(mnt, type, 0))
errs = quotaonoff((char *)dev, mnt->mnt_dir, file, type, QF_VFSV0, flags);
free((char *)dev);