summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog2
-rw-r--r--quotaon.817
-rw-r--r--quotaon.c5
-rw-r--r--quotaon_xfs.c4
-rw-r--r--quotasys.c25
5 files changed, 29 insertions, 24 deletions
diff --git a/Changelog b/Changelog
index 69d56ad..0dc4d91 100644
--- a/Changelog
+++ b/Changelog
@@ -1,5 +1,5 @@
Changes in quota-tools from 3.17 to 4.00-pre2
-* fix quotaon to turn off only limit enforcement on XFS (Eric Sandeen)
+* fix quotaon to work properly with XFS filesystems (Eric Sandeen, Jan Kara )
* fix quotaon to print all informational messages only in verbose mode (Jan Kara)
* fix warnquota manpage to not speak about RPC (Jan Kara)
* fix repquota to get latest quota info header (Jan Kara)
diff --git a/quotaon.8 b/quotaon.8
index 91756a9..37d1be4 100644
--- a/quotaon.8
+++ b/quotaon.8
@@ -112,6 +112,11 @@ Manipulate group quotas.
.B -p, --print-state
Instead of turning quotas on just print state of quotas (ie. whether. quota is on or off)
.TP
+.B -x, --xfs-command enforce
+Switch on limit enforcement for XFS filesystems. This is the default action for
+any XFS filesystem. This option is only applicable to XFS, and is silently
+ignored for other filesystem types.
+.TP
.B -f, --off
Make
.B quotaon
@@ -154,9 +159,15 @@ ignored for other filesystem types.
It can only be used on a filesystem with quota previously turned off.
.TP
.B -x, --xfs-command enforce
-Switch on/off limit enforcement for XFS filesystems (perform
-quota accounting only).
-This option is only applicable to XFS, and is silently
+Switch off limit enforcement for XFS filesystems (perform quota accounting
+only). This is the default action for any XFS filesystem. This option is only
+applicable to XFS, and is silently ignored for other filesystem types.
+.TP
+.B -x, --xfs-command account
+This option can be used to disable quota accounting. It is not possible to
+enable quota accounting by quota tools. Use
+.IR mount (8)
+for that. This option is only applicable to XFS filesystems, and is silently
ignored for other filesystem types.
.SH "NOTES ON XFS FILESYSTEMS"
To enable quotas on an XFS filesystem, use
diff --git a/quotaon.c b/quotaon.c
index 8f7651b..d95996b 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -291,10 +291,7 @@ static int newstate(struct mntent *mnt, int type, char *extra)
errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
return 1;
}
- if ((flags & FL_OFF && (kern_quota_on(mnt->mnt_fsname, USRQUOTA, QF_XFS) != -1
- || kern_quota_on(mnt->mnt_fsname, GRPQUOTA, QF_XFS) != -1))
- || (!(flags & FL_OFF) && kern_quota_on(mnt->mnt_fsname, type, QF_XFS) == -1))
- ret = xfs_newstate(mnt, type, extra, sflags);
+ ret = xfs_newstate(mnt, type, extra, sflags);
}
else if (meta_qf_fstype(mnt->mnt_type)) {
if (!hasquota(mnt, type, 0))
diff --git a/quotaon_xfs.c b/quotaon_xfs.c
index 9cafbd9..0028a88 100644
--- a/quotaon_xfs.c
+++ b/quotaon_xfs.c
@@ -213,9 +213,6 @@ int xfs_newstate(struct mntent *mnt, int type, char *xarg, int flags)
err = xfs_onoff((char *)dev, type, flags, roothack, xopts);
}
else if (strcmp(xarg, "account") == 0) {
- /* only useful if we want root accounting only */
- if (!roothack || !(flags & STATEFLAG_ON))
- goto done;
xopts |= (type == USRQUOTA) ? XFS_QUOTA_UDQ_ACCT : XFS_QUOTA_GDQ_ACCT;
err = xfs_onoff((char *)dev, type, flags, roothack, xopts);
}
@@ -229,7 +226,6 @@ int xfs_newstate(struct mntent *mnt, int type, char *xarg, int flags)
}
else
die(1, _("Invalid argument \"%s\"\n"), xarg);
- done:
free((char *)dev);
return err;
}
diff --git a/quotasys.c b/quotasys.c
index 5b6996c..9bc63b5 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -861,22 +861,23 @@ int kern_quota_on(const char *dev, int type, int fmt)
if (kernel_iface == IFACE_GENERIC) {
int actfmt;
- if (quotactl(QCMD(Q_GETFMT, type), dev, 0, (void *)&actfmt) < 0)
- return -1;
- actfmt = kern2utilfmt(actfmt);
- if (actfmt < 0)
- return -1;
- return actfmt;
+ if (quotactl(QCMD(Q_GETFMT, type), dev, 0,
+ (void *)&actfmt) >= 0) {
+ actfmt = kern2utilfmt(actfmt);
+ if (actfmt >= 0)
+ return actfmt;
+ }
+ } else {
+ if ((fmt == -1 || fmt == QF_VFSV0) &&
+ v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
+ return QF_VFSV0;
+ if ((fmt == -1 || fmt == QF_VFSOLD) &&
+ v1_kern_quota_on(dev, type)) /* Old quota format */
+ return QF_VFSOLD;
}
- if ((fmt == -1 || fmt == QF_VFSV0) &&
- v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
- return QF_VFSV0;
if ((fmt == -1 || fmt == QF_XFS) &&
xfs_kern_quota_on(dev, type)) /* XFS quota format */
return QF_XFS;
- if ((fmt == -1 || fmt == QF_VFSOLD) &&
- v1_kern_quota_on(dev, type)) /* Old quota format */
- return QF_VFSOLD;
return -1;
}