From 86b82591a57198dbe88f5b37402f299a424e1b57 Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Mon, 14 Jun 2010 12:42:57 +0000 Subject: Fix kern_quota_on() to work with XFS filesystems (Jan Kara) Fix quotaon to work correctly with XFS filesystems (Jan Kara) --- quotasys.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'quotasys.c') 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; } -- cgit v1.2.3