Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/bouyer-quota2]: src/sys/ufs/ffs Support MNT_UPDATE for quota2 (especiall...



details:   https://anonhg.NetBSD.org/src/rev/6bcb9e3a888b
branches:  bouyer-quota2
changeset: 761150:6bcb9e3a888b
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Feb 09 19:49:44 2011 +0000

description:
Support MNT_UPDATE for quota2 (especially r/o -> r/w transitions)

diffstat:

 sys/ufs/ffs/ffs_quota2.c |  10 ++++++----
 sys/ufs/ffs/ffs_vfsops.c |  22 ++++++++++++++++++++--
 2 files changed, 26 insertions(+), 6 deletions(-)

diffs (88 lines):

diff -r f361fe7f5653 -r 6bcb9e3a888b sys/ufs/ffs/ffs_quota2.c
--- a/sys/ufs/ffs/ffs_quota2.c  Wed Feb 09 17:48:45 2011 +0000
+++ b/sys/ufs/ffs/ffs_quota2.c  Wed Feb 09 19:49:44 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_quota2.c,v 1.1.2.1 2011/01/20 14:25:02 bouyer Exp $ */
+/* $NetBSD: ffs_quota2.c,v 1.1.2.2 2011/02/09 19:49:44 bouyer Exp $ */
 /*-
   * Copyright (c) 2010 Manuel Bouyer
   * All rights reserved.
@@ -28,7 +28,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_quota2.c,v 1.1.2.1 2011/01/20 14:25:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_quota2.c,v 1.1.2.2 2011/02/09 19:49:44 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -82,7 +82,8 @@
        if (error)
                return error;
 
-        if (fs->fs_quota_flags & FS_Q2_DO_TYPE(USRQUOTA)) {
+        if (fs->fs_quota_flags & FS_Q2_DO_TYPE(USRQUOTA) &&
+           ump->um_quotas[USRQUOTA] == NULLVP) {
                error = VFS_VGET(mp, fs->fs_quotafile[USRQUOTA], &vp);
                if (error) {
                        printf("%s: can't vget() user quota inode: %d\n",
@@ -96,7 +97,8 @@
                mutex_exit(&vp->v_interlock);
                VOP_UNLOCK(vp);
        }
-        if (fs->fs_quota_flags & FS_Q2_DO_TYPE(GRPQUOTA)) {
+        if (fs->fs_quota_flags & FS_Q2_DO_TYPE(GRPQUOTA) &&
+           ump->um_quotas[GRPQUOTA] == NULLVP) {
                error = VFS_VGET(mp, fs->fs_quotafile[GRPQUOTA], &vp);
                if (error) {
                        vn_close(ump->um_quotas[USRQUOTA],
diff -r f361fe7f5653 -r 6bcb9e3a888b sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Wed Feb 09 17:48:45 2011 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Wed Feb 09 19:49:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.263.4.2 2011/02/08 20:00:53 bouyer Exp $      */
+/*     $NetBSD: ffs_vfsops.c,v 1.263.4.3 2011/02/09 19:49:44 bouyer Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.263.4.2 2011/02/08 20:00:53 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.263.4.3 2011/02/09 19:49:44 bouyer Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -492,6 +492,16 @@
                        /*
                         * Changing from read-only to read/write
                         */
+#ifndef QUOTA2
+                       if (fs->fs_flags & FS_DOQUOTA2) {
+                               ump->um_flags |= UFS_QUOTA2;
+                               uprintf("%s: options QUOTA2 not enabled%s\n",
+                                   mp->mnt_stat.f_mntonname,
+                                   (mp->mnt_flag & MNT_FORCE) ? "" :
+                                   ", not mounting");
+                               return EINVAL;
+                       }
+#endif
                        fs->fs_ronly = 0;
                        fs->fs_clean <<= 1;
                        fs->fs_fmod = 1;
@@ -519,6 +529,14 @@
                        return error;
 #endif /* WAPBL */
 
+#ifdef QUOTA2
+               if (!fs->fs_ronly) {
+                       error = ffs_quota2_mount(mp);
+                       if (error) {
+                               return error;
+                       }
+               }
+#endif
                if (args->fspec == NULL)
                        return 0;
        }



Home | Main Index | Thread Index | Old Index