summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2003-11-01 05:51:54 +0000
committerkan <kan@FreeBSD.org>2003-11-01 05:51:54 +0000
commitbc70c0727c709335658c2ab7980d179e736cfc1c (patch)
treefc32ca407dafe0c0f95d6d7b1272204d302f9100 /sys/ufs
parent3ba101637bdc0a936597b3fb777dca1cf0e45a5e (diff)
downloadFreeBSD-src-bc70c0727c709335658c2ab7980d179e736cfc1c.zip
FreeBSD-src-bc70c0727c709335658c2ab7980d179e736cfc1c.tar.gz
Temporarily undo parts of the stuct mount locking commit by jeff.
It is unsafe to hold a mutex across vput/vrele calls. This will be redone when a better locking strategy is agreed upon. Discussed with: jeff
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c7
-rw-r--r--sys/ufs/ufs/ufs_quota.c22
2 files changed, 6 insertions, 23 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 1566137..40839aa 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1112,7 +1112,6 @@ ffs_sync(mp, waitfor, cred, td)
struct ufsmount *ump = VFSTOUFS(mp);
struct fs *fs;
int error, count, wait, lockreq, allerror = 0;
- int restart;
fs = ump->um_fs;
if (fs->fs_fmod != 0 && fs->fs_ronly != 0) { /* XXX */
@@ -1131,7 +1130,6 @@ ffs_sync(mp, waitfor, cred, td)
lockreq |= LK_INTERLOCK;
mtx_lock(&mntvnode_mtx);
loop:
- restart = 0;
for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nvp) {
/*
* If the vnode that we are about to sync is no longer
@@ -1168,12 +1166,9 @@ loop:
}
if ((error = VOP_FSYNC(vp, cred, waitfor, td)) != 0)
allerror = error;
- VOP_UNLOCK(vp, 0, td);
+ vput(vp);
mtx_lock(&mntvnode_mtx);
if (TAILQ_NEXT(vp, v_nmntvnodes) != nvp)
- restart = 1;
- vrele(vp);
- if (restart)
goto loop;
}
mtx_unlock(&mntvnode_mtx);
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index 1eb1ef2..d34f148 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -411,7 +411,6 @@ quotaon(td, mp, type, fname)
struct dquot *dq;
int error, flags;
struct nameidata nd;
- int restart;
error = suser_cred(td->td_ucred, PRISON_ROOT);
if (error)
@@ -458,7 +457,6 @@ quotaon(td, mp, type, fname)
*/
mtx_lock(&mntvnode_mtx);
again:
- restart = 0;
for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nextvp) {
if (vp->v_mount != mp)
goto again;
@@ -475,13 +473,11 @@ again:
continue;
}
error = getinoquota(VTOI(vp));
- mtx_lock(&mntvnode_mtx);
- if (TAILQ_NEXT(vp, v_nmntvnodes) != nextvp)
- restart = 1;
vput(vp);
+ mtx_lock(&mntvnode_mtx);
if (error)
break;
- if (restart)
+ if (TAILQ_NEXT(vp, v_nmntvnodes) != nextvp)
goto again;
}
mtx_unlock(&mntvnode_mtx);
@@ -505,7 +501,6 @@ quotaoff(td, mp, type)
struct ufsmount *ump = VFSTOUFS(mp);
struct dquot *dq;
struct inode *ip;
- int restart;
int error;
error = suser_cred(td->td_ucred, PRISON_ROOT);
@@ -521,7 +516,6 @@ quotaoff(td, mp, type)
*/
mtx_lock(&mntvnode_mtx);
again:
- restart = 0;
for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nextvp) {
if (vp->v_mount != mp)
goto again;
@@ -542,11 +536,9 @@ again:
dq = ip->i_dquot[type];
ip->i_dquot[type] = NODQUOT;
dqrele(vp, dq);
+ vput(vp);
mtx_lock(&mntvnode_mtx);
if (TAILQ_NEXT(vp, v_nmntvnodes) != nextvp)
- restart = 1;
- vput(vp);
- if (restart)
goto again;
}
mtx_unlock(&mntvnode_mtx);
@@ -739,7 +731,6 @@ qsync(mp)
struct thread *td = curthread; /* XXX */
struct vnode *vp, *nextvp;
struct dquot *dq;
- int restart;
int i, error;
/*
@@ -757,7 +748,6 @@ qsync(mp)
*/
mtx_lock(&mntvnode_mtx);
again:
- restart = 0;
for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nextvp) {
if (vp->v_mount != mp)
goto again;
@@ -781,11 +771,9 @@ again:
if (dq != NODQUOT && (dq->dq_flags & DQ_MOD))
dqsync(vp, dq);
}
- if (TAILQ_NEXT(vp, v_nmntvnodes) != nextvp)
- restart = 1;
- mtx_lock(&mntvnode_mtx);
vput(vp);
- if (restart)
+ mtx_lock(&mntvnode_mtx);
+ if (TAILQ_NEXT(vp, v_nmntvnodes) != nextvp)
goto again;
}
mtx_unlock(&mntvnode_mtx);
OpenPOWER on IntegriCloud