From eb602e48b88473af4d6d813b9b1a403998994d0e Mon Sep 17 00:00:00 2001 From: Petr Pisar Date: May 11 2010 12:00:53 +0000 Subject: Add GFS2 support --- diff --git a/quota-3.17-add-gfs2-support.patch b/quota-3.17-add-gfs2-support.patch new file mode 100644 index 0000000..16f83c4 --- /dev/null +++ b/quota-3.17-add-gfs2-support.patch @@ -0,0 +1,95 @@ +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; diff --git a/quota.spec b/quota.spec index 4190385..800b206 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: 12%{?dist} +Release: 13%{?dist} License: BSD and GPLv2+ URL: http://sourceforge.net/projects/linuxquota/ Group: System Environment/Base @@ -26,6 +26,8 @@ Patch7: quota-3.17-quotactlmanpage.patch Patch8: quota-3.17-ftbfs.patch # Bug #528581, remove in upstream 4.00 Patch9: quota-3.17-quotactl_null_corruption.patch +# Included in upstream 4.00_pre2 +Patch10: quota-3.17-add-gfs2-support.patch %description The quota package contains system administration tools for monitoring @@ -58,6 +60,7 @@ on remote machines. %patch7 -p1 -b .quotactlman %patch8 -p1 %patch9 -p1 -b .quotactl_null_corruption +%patch10 -p1 -b .gfs2 #fix typos/mistakes in localized documentation for pofile in $(find ./po/*.p*) @@ -120,6 +123,9 @@ rm -rf %{buildroot} %attr(0644,root,root) %{_mandir}/man3/* %changelog +* Tue May 11 2010 Petr Pisar 1:3.17-13 +- Add GFS2 support + * Tue May 10 2010 Petr Pisar 1:3.17-12 - Prevent corruptive read/write from/to NULL address in rpc.rquotad (Resolves #528581, example in #532342)