Mon Feb 2 18:24:17 2009 UTC ()
Pull up following revision(s) (requested by ad in ticket #351):
	sys/ufs/ufs/ufs_quota.c: revision 1.61
Print a warning message and return EOPNOTSUPP if the user tries to enable
quotas on a file system that is using logging.


(snj)
diff -r1.60 -r1.60.10.1 src/sys/ufs/ufs/ufs_quota.c

cvs diff -r1.60 -r1.60.10.1 src/sys/ufs/ufs/ufs_quota.c (expand / switch to unified diff)

--- src/sys/ufs/ufs/ufs_quota.c 2008/05/05 17:11:17 1.60
+++ src/sys/ufs/ufs/ufs_quota.c 2009/02/02 18:24:17 1.60.10.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ufs_quota.c,v 1.60 2008/05/05 17:11:17 ad Exp $ */ 1/* $NetBSD: ufs_quota.c,v 1.60.10.1 2009/02/02 18:24:17 snj Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1990, 1993, 1995 4 * Copyright (c) 1982, 1986, 1990, 1993, 1995
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Robert Elz at The University of Melbourne. 8 * Robert Elz at The University of Melbourne.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 * 33 *
34 * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 34 * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60 2008/05/05 17:11:17 ad Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.1 2009/02/02 18:24:17 snj Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/namei.h> 43#include <sys/namei.h>
44#include <sys/file.h> 44#include <sys/file.h>
45#include <sys/proc.h> 45#include <sys/proc.h>
46#include <sys/vnode.h> 46#include <sys/vnode.h>
47#include <sys/mount.h> 47#include <sys/mount.h>
48#include <sys/kauth.h> 48#include <sys/kauth.h>
49 49
50#include <ufs/ufs/quota.h> 50#include <ufs/ufs/quota.h>
51#include <ufs/ufs/inode.h> 51#include <ufs/ufs/inode.h>
@@ -406,26 +406,33 @@ chkiqchg(struct inode *ip, int32_t chang @@ -406,26 +406,33 @@ chkiqchg(struct inode *ip, int32_t chang
406 406
407/* 407/*
408 * Q_QUOTAON - set up a quota file for a particular file system. 408 * Q_QUOTAON - set up a quota file for a particular file system.
409 */ 409 */
410int 410int
411quotaon(struct lwp *l, struct mount *mp, int type, void *fname) 411quotaon(struct lwp *l, struct mount *mp, int type, void *fname)
412{ 412{
413 struct ufsmount *ump = VFSTOUFS(mp); 413 struct ufsmount *ump = VFSTOUFS(mp);
414 struct vnode *vp, **vpp, *mvp; 414 struct vnode *vp, **vpp, *mvp;
415 struct dquot *dq; 415 struct dquot *dq;
416 int error; 416 int error;
417 struct nameidata nd; 417 struct nameidata nd;
418 418
 419 /* XXX XXX XXX */
 420 if (mp->mnt_wapbl != NULL) {
 421 printf("%s: quotas cannot yet be used with -o log\n",
 422 mp->mnt_stat.f_mntonname);
 423 return (EOPNOTSUPP);
 424 }
 425
419 vpp = &ump->um_quotas[type]; 426 vpp = &ump->um_quotas[type];
420 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname); 427 NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname);
421 if ((error = vn_open(&nd, FREAD|FWRITE, 0)) != 0) 428 if ((error = vn_open(&nd, FREAD|FWRITE, 0)) != 0)
422 return (error); 429 return (error);
423 vp = nd.ni_vp; 430 vp = nd.ni_vp;
424 VOP_UNLOCK(vp, 0); 431 VOP_UNLOCK(vp, 0);
425 if (vp->v_type != VREG) { 432 if (vp->v_type != VREG) {
426 (void) vn_close(vp, FREAD|FWRITE, l->l_cred); 433 (void) vn_close(vp, FREAD|FWRITE, l->l_cred);
427 return (EACCES); 434 return (EACCES);
428 } 435 }
429 if (*vpp != vp) 436 if (*vpp != vp)
430 quotaoff(l, mp, type); 437 quotaoff(l, mp, type);
431 mutex_enter(&dqlock); 438 mutex_enter(&dqlock);