summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_sync.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-02-27 08:46:11 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-02-27 08:46:11 +0000
commit68ce2342f8432890c5474826d1c6f61d79bcf3da (patch)
treea9fbca3de158c75447030318702263fc17839232 /sys/kern/vfs_sync.c
parent69dbab6810963e296e7ec0142b71fe2cf7318ca7 (diff)
Instead of doing VOP_ISLOCKED, vn_lock(..LK_RETRY..) we can do vn_lock(..LK_NOWAIT..).
Also, when we fail to get the lock on the vnode we want to sync, push it ahead one second in time. XXX - this could lead to some vnodes not being synced for a long time, but that is better than a panic.
Diffstat (limited to 'sys/kern/vfs_sync.c')
-rw-r--r--sys/kern/vfs_sync.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c
index cb88a051466..3998673834f 100644
--- a/sys/kern/vfs_sync.c
+++ b/sys/kern/vfs_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_sync.c,v 1.16 2001/02/24 23:50:00 csapuntz Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.17 2001/02/27 08:46:10 art Exp $ */
/*
* Portions of this code are:
@@ -164,12 +164,18 @@ sched_sync(p)
syncer_delayno = 0;
s = splbio();
while ((vp = LIST_FIRST(slp)) != NULL) {
- splx(s);
- if (VOP_ISLOCKED(vp) == 0) {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- (void) VOP_FSYNC(vp, p->p_ucred, MNT_LAZY, p);
- VOP_UNLOCK(vp, 0, p);
+ if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, p) != 0) {
+ /*
+ * If we fail to get the lock, we move this
+ * vnode one second ahead in time.
+ * XXX - no good, but the best we can do.
+ */
+ vn_syncer_add_to_worklist(vp, 1);
+ continue;
}
+ splx(s);
+ (void) VOP_FSYNC(vp, p->p_ucred, MNT_LAZY, p);
+ VOP_UNLOCK(vp, 0, p);
s = splbio();
if (LIST_FIRST(slp) == vp) {
/*