| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ufs_quota.c,v 1.60.10.2 2009/08/07 05:59:17 snj Exp $ */ | | 1 | /* $NetBSD: ufs_quota.c,v 1.60.10.3 2009/08/07 05:59:44 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.10.2 2009/08/07 05:59:17 snj Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.60.10.3 2009/08/07 05:59:44 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> |
| @@ -877,27 +877,27 @@ dqget(struct vnode *vp, u_long id, struc | | | @@ -877,27 +877,27 @@ dqget(struct vnode *vp, u_long id, struc |
877 | mutex_init(&ndq->dq_interlock, MUTEX_DEFAULT, IPL_NONE); | | 877 | mutex_init(&ndq->dq_interlock, MUTEX_DEFAULT, IPL_NONE); |
878 | mutex_enter(&dqlock); | | 878 | mutex_enter(&dqlock); |
879 | dqh = &dqhashtbl[DQHASH(dqvp, id)]; | | 879 | dqh = &dqhashtbl[DQHASH(dqvp, id)]; |
880 | LIST_FOREACH(dq, dqh, dq_hash) { | | 880 | LIST_FOREACH(dq, dqh, dq_hash) { |
881 | if (dq->dq_id != id || | | 881 | if (dq->dq_id != id || |
882 | dq->dq_ump->um_quotas[dq->dq_type] != dqvp) | | 882 | dq->dq_ump->um_quotas[dq->dq_type] != dqvp) |
883 | continue; | | 883 | continue; |
884 | /* | | 884 | /* |
885 | * Another thread beat us allocating this dquot. | | 885 | * Another thread beat us allocating this dquot. |
886 | */ | | 886 | */ |
887 | KASSERT(dq->dq_cnt > 0); | | 887 | KASSERT(dq->dq_cnt > 0); |
888 | dqref(dq); | | 888 | dqref(dq); |
889 | mutex_exit(&dqlock); | | 889 | mutex_exit(&dqlock); |
890 | mutex_destroy(&dq->dq_interlock); | | 890 | mutex_destroy(&ndq->dq_interlock); |
891 | pool_cache_put(dquot_cache, ndq); | | 891 | pool_cache_put(dquot_cache, ndq); |
892 | *dqp = dq; | | 892 | *dqp = dq; |
893 | return 0; | | 893 | return 0; |
894 | } | | 894 | } |
895 | dq = ndq; | | 895 | dq = ndq; |
896 | LIST_INSERT_HEAD(dqh, dq, dq_hash); | | 896 | LIST_INSERT_HEAD(dqh, dq, dq_hash); |
897 | dqref(dq); | | 897 | dqref(dq); |
898 | mutex_enter(&dq->dq_interlock); | | 898 | mutex_enter(&dq->dq_interlock); |
899 | mutex_exit(&dqlock); | | 899 | mutex_exit(&dqlock); |
900 | vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY); | | 900 | vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY); |
901 | auio.uio_iov = &aiov; | | 901 | auio.uio_iov = &aiov; |
902 | auio.uio_iovcnt = 1; | | 902 | auio.uio_iovcnt = 1; |
903 | aiov.iov_base = (void *)&dq->dq_dqb; | | 903 | aiov.iov_base = (void *)&dq->dq_dqb; |