Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 2015 10:32:50 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277794 - head/sys/ufs/ufs
Message-ID:  <201501271032.t0RAWotv061014@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jan 27 10:32:49 2015
New Revision: 277794
URL: https://svnweb.freebsd.org/changeset/base/277794

Log:
  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

Modified:
  head/sys/ufs/ufs/ufs_quota.c
  head/sys/ufs/ufs/ufs_vfsops.c

Modified: head/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- head/sys/ufs/ufs/ufs_quota.c	Tue Jan 27 09:48:02 2015	(r277793)
+++ head/sys/ufs/ufs/ufs_quota.c	Tue Jan 27 10:32:49 2015	(r277794)
@@ -495,11 +495,15 @@ quotaon(struct thread *td, struct mount 
 	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;

Modified: head/sys/ufs/ufs/ufs_vfsops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vfsops.c	Tue Jan 27 09:48:02 2015	(r277793)
+++ head/sys/ufs/ufs/ufs_vfsops.c	Tue Jan 27 10:32:49 2015	(r277794)
@@ -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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501271032.t0RAWotv061014>