diff options
| author | hannken <hannken@NetBSD.org> | 2003-10-15 11:28:59 +0000 |
|---|---|---|
| committer | hannken <hannken@NetBSD.org> | 2003-10-15 11:28:59 +0000 |
| commit | a3a898ff0fc5ce3d892d5a2b7764d612b1253edd (patch) | |
| tree | 3fead4de9cb0e170d29ff2ff73e5481248e9cb8f /sys/dev | |
| parent | 9f105a9400dd34be146e2210fab82bfaf5e8e100 (diff) | |
Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.
From FreeBSD with slight modifications.
Approved by: Frank van der Linden <fvdl@netbsd.org>
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/vnd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 161a5d763fc..6a4ad411454 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.102 2003/08/07 16:30:52 agc Exp $ */ +/* $NetBSD: vnd.c,v 1.103 2003/10/15 11:28:59 hannken Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -133,7 +133,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.102 2003/08/07 16:30:52 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.103 2003/10/15 11:28:59 hannken Exp $"); #if defined(_KERNEL_OPT) #include "fs_nfs.h" @@ -408,6 +408,7 @@ vndstrategy(bp) int unit = vndunit(bp->b_dev); struct vnd_softc *vnd = &vnd_softc[unit]; struct vndxfer *vnx; + struct mount *mp; int s, bsize, resid; off_t bn; caddr_t addr; @@ -495,6 +496,9 @@ vndstrategy(bp) vnx->vx_pending = 0; vnx->vx_bp = bp; + if ((flags & B_READ) == 0) + vn_start_write(vnd->sc_vp, &mp, V_WAIT); + for (resid = bp->b_resid; resid; resid -= sz) { struct vndbuf *nbp; struct vnode *vp; @@ -579,6 +583,8 @@ vndstrategy(bp) s = splbio(); out: /* Arrive here at splbio */ + if ((flags & B_READ) == 0) + vn_finished_write(mp, 0); vnx->vx_flags &= ~VX_BUSY; if (vnx->vx_pending == 0) { if (vnx->vx_error != 0) { |
