Author: kib
Date: Tue Feb  3 11:54:33 2015
New Revision: 278150
URL: https://svnweb.freebsd.org/changeset/base/278150

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

Modified:
  stable/10/sys/ufs/ufs/ufs_quota.c
  stable/10/sys/ufs/ufs/ufs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- stable/10/sys/ufs/ufs/ufs_quota.c   Tue Feb  3 11:45:01 2015        
(r278149)
+++ stable/10/sys/ufs/ufs/ufs_quota.c   Tue Feb  3 11:54:33 2015        
(r278150)
@@ -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: stable/10/sys/ufs/ufs/ufs_vfsops.c
==============================================================================
--- stable/10/sys/ufs/ufs/ufs_vfsops.c  Tue Feb  3 11:45:01 2015        
(r278149)
+++ stable/10/sys/ufs/ufs/ufs_vfsops.c  Tue Feb  3 11:54:33 2015        
(r278150)
@@ -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:
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "[email protected]"

Reply via email to