Backport of patch from #547748 that is already in upstream.
Original patch adds some GFS checks to XFS checks in create_handle_list(),
but current RHEL-6 does not contain the checks for fro XFS. So ommiting them.
diff --git a/mntopt.h b/mntopt.h
index ee375c4..1730340 100644
--- a/mntopt.h
+++ b/mntopt.h
@@ -18,6 +18,7 @@
#define MNTTYPE_NFS4 "nfs4" /* NFSv4 filesystem */
#define MNTTYPE_MPFS "mpfs" /* EMC Celerra MPFS filesystem */
#define MNTTYPE_OCFS2 "ocfs2" /* Oracle Cluster filesystem */
+#define MNTTYPE_GFS2 "gfs2" /* Red Hat Global filesystem 2 */
/* mount options */
#define MNTOPT_NOQUOTA "noquota" /* don't enforce quota */
diff --git a/quotacheck.c b/quotacheck.c
index b5f7e2e..3c56eee 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -1048,7 +1048,9 @@ static void check_all(void)
while ((mnt = get_next_mount())) {
if (flags & FL_ALL && flags & FL_NOROOT && !strcmp(mnt->mnt_dir, "/"))
continue;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) || nfs_fstype(mnt->mnt_type) ||
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
+ nfs_fstype(mnt->mnt_type) ||
meta_qf_fstype(mnt->mnt_type)) {
debug(FL_DEBUG | FL_VERBOSE, _("Skipping %s [%s]\n"), mnt->mnt_fsname, mnt->mnt_dir);
continue;
diff --git a/quotaio.c b/quotaio.c
index d74a37d..0dd8324 100644
--- a/quotaio.c
+++ b/quotaio.c
@@ -73,7 +73,8 @@ struct quota_handle *init_io(struct mntent *mnt, int type, int fmt, int flags)
#endif
}
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) { /* XFS filesystem? */
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) || /* XFS filesystem? */
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2)) { /* XFS filesystem? */
if (fmt != -1 && fmt != QF_XFS) { /* User wanted some other format? */
errstr(_("Only XFS quota format is allowed on XFS filesystem.\n"));
goto out_handle;
diff --git a/quotaon.c b/quotaon.c
index eafadef..0e6e363 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -163,7 +163,10 @@ static int newstate(struct mntent *mnt, int type, char *extra)
if (flags & FL_ALL)
sflags |= STATEFLAG_ALL;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) { /* XFS filesystem has special handling... */
+ if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2)) {
+ errstr(_("Cannot change state of GFS2 quota.\n"));
+ return 1;
+ } else if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) { /* XFS filesystem has special handling... */
if (!(kernel_formats & (1 << QF_XFS))) {
errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
return 1;
@@ -200,7 +203,8 @@ static int print_state(struct mntent *mnt, int type)
{
int on = 0;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS)) {
+ if (!strcmp(mnt->mnt_type, MNTTYPE_XFS) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_GFS2)) {
if (kernel_formats & (1 << QF_XFS))
on = kern_quota_on(mnt->mnt_fsname, type, 1 << QF_XFS) != -1;
}
diff --git a/quotasys.c b/quotasys.c
index 9a7f440..2ec23c4 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -82,7 +82,8 @@ static int correct_fstype(char *type)
!strcmp(type, MNTTYPE_NFS) ||
!strcmp(type, MNTTYPE_NFS4) ||
!strcmp(type, MNTTYPE_OCFS2) ||
- !strcmp(type, MNTTYPE_MPFS)) {
+ !strcmp(type, MNTTYPE_MPFS) ||
+ !strcmp(type, MNTTYPE_GFS2)) {
free(mtype);
return 1;
}
@@ -481,7 +482,8 @@ int hasquota(struct mntent *mnt, int type, int flags)
if (!correct_fstype(mnt->mnt_type) || hasmntopt(mnt, MNTOPT_NOQUOTA))
return 0;
- if (!strcmp(mnt->mnt_type, MNTTYPE_XFS))
+ if (!strcmp(mnt->mnt_type, MNTTYPE_GFS2) ||
+ !strcmp(mnt->mnt_type, MNTTYPE_XFS))
return hasxfsquota(mnt, type, flags);
if (nfs_fstype(mnt->mnt_type)) /* NFS always has quota or better there is no good way how to detect it */
return 1;