summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-02-03 11:54:33 +0000
committerkib <kib@FreeBSD.org>2015-02-03 11:54:33 +0000
commit5e5b664385bb81f5067727b8490905d696ed8549 (patch)
tree0817d7b3d15ea88f92116ec9a123d79b75f00b47
parentd4cd0639f3b5d7376805c8a1ae75cbdeb914cfe4 (diff)
downloadFreeBSD-src-5e5b664385bb81f5067727b8490905d696ed8549.zip
FreeBSD-src-5e5b664385bb81f5067727b8490905d696ed8549.tar.gz
MFC r277794:
The sys_quotactl() contract demands that the mount point is vfs_unbusy()ed when the cmd is Q_QUOTAON, regardless of other input parameters or error return.
-rw-r--r--sys/ufs/ufs/ufs_quota.c8
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c10
2 files changed, 15 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index a6e139a..7f11e54 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -495,11 +495,15 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname)
struct nameidata nd;
error = priv_check(td, PRIV_UFS_QUOTAON);
- if (error)
+ if (error != 0) {
+ vfs_unbusy(mp);
return (error);
+ }
- if (mp->mnt_flag & MNT_RDONLY)
+ if ((mp->mnt_flag & MNT_RDONLY) != 0) {
+ vfs_unbusy(mp);
return (EROFS);
+ }
ump = VFSTOUFS(mp);
dq = NODQUOT;
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 74a863a..5bb73ea 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -92,6 +92,9 @@ ufs_quotactl(mp, cmds, id, arg)
void *arg;
{
#ifndef QUOTA
+ if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON)
+ vfs_unbusy(mp);
+
return (EOPNOTSUPP);
#else
struct thread *td;
@@ -112,11 +115,16 @@ ufs_quotactl(mp, cmds, id, arg)
break;
default:
+ if (cmd == Q_QUOTAON)
+ vfs_unbusy(mp);
return (EINVAL);
}
}
- if ((u_int)type >= MAXQUOTAS)
+ if ((u_int)type >= MAXQUOTAS) {
+ if (cmd == Q_QUOTAON)
+ vfs_unbusy(mp);
return (EINVAL);
+ }
switch (cmd) {
case Q_QUOTAON:
OpenPOWER on IntegriCloud