Module Name:    src
Committed By:   bouyer
Date:           Wed Feb  9 19:49:45 UTC 2011

Modified Files:
        src/sys/ufs/ffs [bouyer-quota2]: ffs_quota2.c ffs_vfsops.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/ufs/ffs/ffs_quota2.c
cvs rdiff -u -r1.263.4.2 -r1.263.4.3 src/sys/ufs/ffs/ffs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ufs/ffs/ffs_quota2.c
diff -u src/sys/ufs/ffs/ffs_quota2.c:1.1.2.1 src/sys/ufs/ffs/ffs_quota2.c:1.1.2.2
--- src/sys/ufs/ffs/ffs_quota2.c:1.1.2.1	Thu Jan 20 14:25:02 2011
+++ src/sys/ufs/ffs/ffs_quota2.c	Wed Feb  9 19:49:44 2011
@@ -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],

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.263.4.2 src/sys/ufs/ffs/ffs_vfsops.c:1.263.4.3
--- src/sys/ufs/ffs/ffs_vfsops.c:1.263.4.2	Tue Feb  8 20:00:53 2011
+++ src/sys/ufs/ffs/ffs_vfsops.c	Wed Feb  9 19:49:44 2011
@@ -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;
 	}

Reply via email to