Deleted Added
full compact
ufs_quota.c (170587) ufs_quota.c (175202)
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Robert Elz at The University of Melbourne.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95
33 */
34
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Robert Elz at The University of Melbourne.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/ufs/ufs/ufs_quota.c 170587 2007-06-12 00:12:01Z rwatson $");
36__FBSDID("$FreeBSD: head/sys/ufs/ufs/ufs_quota.c 175202 2008-01-10 01:10:58Z attilio $");
37
38#include "opt_ffs.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/fcntl.h>
43#include <sys/kernel.h>
44#include <sys/lock.h>

--- 504 unchanged lines hidden (view full) ---

549 mp->mnt_flag |= MNT_QUOTA;
550 MNT_IUNLOCK(mp);
551 UFS_UNLOCK(ump);
552
553 vpp = &ump->um_quotas[type];
554 if (*vpp != vp)
555 quotaoff1(td, mp, type);
556
37
38#include "opt_ffs.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/fcntl.h>
43#include <sys/kernel.h>
44#include <sys/lock.h>

--- 504 unchanged lines hidden (view full) ---

549 mp->mnt_flag |= MNT_QUOTA;
550 MNT_IUNLOCK(mp);
551 UFS_UNLOCK(ump);
552
553 vpp = &ump->um_quotas[type];
554 if (*vpp != vp)
555 quotaoff1(td, mp, type);
556
557 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
557 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
558 vp->v_vflag |= VV_SYSTEM;
559 VOP_UNLOCK(vp, 0, td);
560 *vpp = vp;
561 VFS_UNLOCK_GIANT(vfslocked);
562 /*
563 * Save the credential of the process that turned on quotas.
564 * Set up the time limits for this quota.
565 */

--- 122 unchanged lines hidden (view full) ---

688 * access to the closed vnode from dqget/dqsync
689 */
690 UFS_LOCK(ump);
691 ump->um_quotas[type] = NULLVP;
692 ump->um_cred[type] = NOCRED;
693 UFS_UNLOCK(ump);
694
695 vfslocked = VFS_LOCK_GIANT(qvp->v_mount);
558 vp->v_vflag |= VV_SYSTEM;
559 VOP_UNLOCK(vp, 0, td);
560 *vpp = vp;
561 VFS_UNLOCK_GIANT(vfslocked);
562 /*
563 * Save the credential of the process that turned on quotas.
564 * Set up the time limits for this quota.
565 */

--- 122 unchanged lines hidden (view full) ---

688 * access to the closed vnode from dqget/dqsync
689 */
690 UFS_LOCK(ump);
691 ump->um_quotas[type] = NULLVP;
692 ump->um_cred[type] = NOCRED;
693 UFS_UNLOCK(ump);
694
695 vfslocked = VFS_LOCK_GIANT(qvp->v_mount);
696 vn_lock(qvp, LK_EXCLUSIVE | LK_RETRY, td);
696 vn_lock(qvp, LK_EXCLUSIVE | LK_RETRY);
697 qvp->v_vflag &= ~VV_SYSTEM;
698 VOP_UNLOCK(qvp, 0, td);
699 error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td);
700 VFS_UNLOCK_GIANT(vfslocked);
701 crfree(cr);
702
703 return (error);
704}

--- 377 unchanged lines hidden (view full) ---

1082static int
1083dqget(vp, id, ump, type, dqp)
1084 struct vnode *vp;
1085 u_long id;
1086 struct ufsmount *ump;
1087 int type;
1088 struct dquot **dqp;
1089{
697 qvp->v_vflag &= ~VV_SYSTEM;
698 VOP_UNLOCK(qvp, 0, td);
699 error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td);
700 VFS_UNLOCK_GIANT(vfslocked);
701 crfree(cr);
702
703 return (error);
704}

--- 377 unchanged lines hidden (view full) ---

1082static int
1083dqget(vp, id, ump, type, dqp)
1084 struct vnode *vp;
1085 u_long id;
1086 struct ufsmount *ump;
1087 int type;
1088 struct dquot **dqp;
1089{
1090 struct thread *td = curthread; /* XXX */
1091 struct dquot *dq, *dq1;
1092 struct dqhash *dqh;
1093 struct vnode *dqvp;
1094 struct iovec aiov;
1095 struct uio auio;
1096 int vfslocked, dqvplocked, error;
1097
1098#ifdef DEBUG_VFS_LOCKS

--- 50 unchanged lines hidden (view full) ---

1149 }
1150
1151 /*
1152 * Quota vnode lock is before DQ_LOCK. Acquire dqvp lock there
1153 * since new dq will appear on the hash chain DQ_LOCKed.
1154 */
1155 if (vp != dqvp) {
1156 DQH_UNLOCK();
1090 struct dquot *dq, *dq1;
1091 struct dqhash *dqh;
1092 struct vnode *dqvp;
1093 struct iovec aiov;
1094 struct uio auio;
1095 int vfslocked, dqvplocked, error;
1096
1097#ifdef DEBUG_VFS_LOCKS

--- 50 unchanged lines hidden (view full) ---

1148 }
1149
1150 /*
1151 * Quota vnode lock is before DQ_LOCK. Acquire dqvp lock there
1152 * since new dq will appear on the hash chain DQ_LOCKed.
1153 */
1154 if (vp != dqvp) {
1155 DQH_UNLOCK();
1157 vn_lock(dqvp, LK_SHARED | LK_RETRY, td);
1156 vn_lock(dqvp, LK_SHARED | LK_RETRY);
1158 dqvplocked = 1;
1159 DQH_LOCK();
1160 /*
1161 * Recheck the cache after sleep for quota vnode lock.
1162 */
1163 dq = dqhashfind(dqh, id, dqvp);
1164 if (dq != NULL) {
1165 DQH_UNLOCK();

--- 171 unchanged lines hidden (view full) ---

1337/*
1338 * Update the disk quota in the quota file.
1339 */
1340static int
1341dqsync(vp, dq)
1342 struct vnode *vp;
1343 struct dquot *dq;
1344{
1157 dqvplocked = 1;
1158 DQH_LOCK();
1159 /*
1160 * Recheck the cache after sleep for quota vnode lock.
1161 */
1162 dq = dqhashfind(dqh, id, dqvp);
1163 if (dq != NULL) {
1164 DQH_UNLOCK();

--- 171 unchanged lines hidden (view full) ---

1336/*
1337 * Update the disk quota in the quota file.
1338 */
1339static int
1340dqsync(vp, dq)
1341 struct vnode *vp;
1342 struct dquot *dq;
1343{
1345 struct thread *td = curthread; /* XXX */
1346 struct vnode *dqvp;
1347 struct iovec aiov;
1348 struct uio auio;
1349 int vfslocked, error;
1350 struct mount *mp;
1351 struct ufsmount *ump;
1352
1353#ifdef DEBUG_VFS_LOCKS

--- 20 unchanged lines hidden (view full) ---

1374 vrele(dqvp);
1375 VFS_UNLOCK_GIANT(vfslocked);
1376 return (0);
1377 }
1378 DQI_UNLOCK(dq);
1379
1380 (void) vn_start_secondary_write(dqvp, &mp, V_WAIT);
1381 if (vp != dqvp)
1344 struct vnode *dqvp;
1345 struct iovec aiov;
1346 struct uio auio;
1347 int vfslocked, error;
1348 struct mount *mp;
1349 struct ufsmount *ump;
1350
1351#ifdef DEBUG_VFS_LOCKS

--- 20 unchanged lines hidden (view full) ---

1372 vrele(dqvp);
1373 VFS_UNLOCK_GIANT(vfslocked);
1374 return (0);
1375 }
1376 DQI_UNLOCK(dq);
1377
1378 (void) vn_start_secondary_write(dqvp, &mp, V_WAIT);
1379 if (vp != dqvp)
1382 vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, td);
1380 vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY);
1383
1384 VFS_UNLOCK_GIANT(vfslocked);
1385 DQI_LOCK(dq);
1386 DQI_WAIT(dq, PINOD+2, "dqsync");
1387 if ((dq->dq_flags & DQ_MOD) == 0)
1388 goto out;
1389 dq->dq_flags |= DQ_LOCK;
1390 DQI_UNLOCK(dq);

--- 59 unchanged lines hidden ---
1381
1382 VFS_UNLOCK_GIANT(vfslocked);
1383 DQI_LOCK(dq);
1384 DQI_WAIT(dq, PINOD+2, "dqsync");
1385 if ((dq->dq_flags & DQ_MOD) == 0)
1386 goto out;
1387 dq->dq_flags |= DQ_LOCK;
1388 DQI_UNLOCK(dq);

--- 59 unchanged lines hidden ---