diff options
author | kib <kib@FreeBSD.org> | 2015-01-27 10:32:49 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-01-27 10:32:49 +0000 |
commit | da0490b2e8a0b49115c136dfbd1b51040bd86e65 (patch) | |
tree | b12fdd70e33530cbfff0e0154948dba7e641e8fe /sys/ufs | |
parent | 116b4521e0a6903ba21288663ce802f7a9a34d3d (diff) | |
download | FreeBSD-src-da0490b2e8a0b49115c136dfbd1b51040bd86e65.zip FreeBSD-src-da0490b2e8a0b49115c136dfbd1b51040bd86e65.tar.gz |
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.
Submitted by: Conrad Meyer
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D1684
Tested by: pho
MFC after: 1 week
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 8 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vfsops.c | 10 |
2 files changed, 15 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 132fab2..4fbb8a1 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: |