+ struct vnode *rootvp = NULLVP;
+ int quotafilecnt = 0;
+
+ /* Find out how many quota files we have open. */
+ for (i = 0; i < MAXQUOTAS; i++) {
+ if (ump->um_qfiles[i].qf_vp != NULLVP)
+ ++quotafilecnt;
+ }
+
+ /*
+ * Check if the root vnode is in our inode hash
+ * (so we can skip over it).
+ */
+ rootvp = ufs_ihashget(ump->um_dev, ROOTINO);
+
+ error = vflush(mp, rootvp, SKIPSYSTEM|flags);
+
+ if (rootvp) {
+ /*
+ * See if there are additional references on the
+ * root vp besides the ones obtained from the open
+ * quota files and the hfs_chashget call above.
+ */
+ if ((error == 0) &&
+ (rootvp->v_usecount > (1 + quotafilecnt))) {
+ error = EBUSY; /* root dir is still open */
+ }
+ vput(rootvp);
+ }
+ if (error && (flags & FORCECLOSE) == 0)