summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_sync.c
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2004-08-15 18:22:30 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2004-08-15 18:22:30 +0000
commit53e6a1a55fd82f820d0ce8deef8d6a9d906dd516 (patch)
tree71829b3ac3d8beda5a6ff80cf781f40a7a412298 /sys/kern/vfs_sync.c
parentcf5935b68ef19e8c9ec018aa1ff9d4cf5b1ddbf5 (diff)
protect code dealing with the vnode sync list with splbio(). fixes the
'fsync failed' panic on amd64. discussed with and ok'd by art@, tedu@ and deraadt@. tested by many (thanks).
Diffstat (limited to 'sys/kern/vfs_sync.c')
-rw-r--r--sys/kern/vfs_sync.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c
index 3c6e275a99d..77d503ed825 100644
--- a/sys/kern/vfs_sync.c
+++ b/sys/kern/vfs_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_sync.c,v 1.27 2004/08/03 13:34:48 art Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.28 2004/08/15 18:22:29 pedro Exp $ */
/*
* Portions of this code are:
@@ -152,11 +152,13 @@ sched_sync(p)
/*
* Push files whose dirty time has expired.
*/
+ s = splbio();
slp = &syncer_workitem_pending[syncer_delayno];
+
syncer_delayno += 1;
if (syncer_delayno == syncer_maxdelay)
syncer_delayno = 0;
- s = splbio();
+
while ((vp = LIST_FIRST(slp)) != NULL) {
if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, p) != 0) {
/*
@@ -383,16 +385,25 @@ sync_inactive(v)
} */ *ap = v;
struct vnode *vp = ap->a_vp;
+ int s;
if (vp->v_usecount == 0) {
VOP_UNLOCK(vp, 0, ap->a_p);
return (0);
}
+
vp->v_mount->mnt_syncer = NULL;
+
+ s = splbio();
+
LIST_REMOVE(vp, v_synclist);
vp->v_bioflag &= ~VBIOONSYNCLIST;
+
+ splx(s);
+
vp->v_writecount = 0;
vput(vp);
+
return (0);
}