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