diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-12-03 19:57:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-12-03 19:57:05 +0000 |
commit | 61767b55ba4ea99a21e1b78a4162d30d92a5fe1f (patch) | |
tree | c5bb7184272862884a2a252b6f6c2a3d09a576be /sys | |
parent | 1ecf18373c91d60af7db8723e74afd85127430d3 (diff) |
Close disk images if the client disconnects. This makes it possible to
replace a disk image and have it visible to the guest when it reboots
instead of having to reboot the primary domain.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc64/dev/vdsp.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/arch/sparc64/dev/vdsp.c b/sys/arch/sparc64/dev/vdsp.c index 8ef94fcc93b..9fedc903111 100644 --- a/sys/arch/sparc64/dev/vdsp.c +++ b/sys/arch/sparc64/dev/vdsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsp.c,v 1.15 2012/12/02 19:34:35 kettenis Exp $ */ +/* $OpenBSD: vdsp.c,v 1.16 2012/12/03 19:57:04 kettenis Exp $ */ /* * Copyright (c) 2009, 2011 Mark Kettenis * @@ -279,6 +279,7 @@ void vdsp_sendmsg(struct vdsp_softc *, void *, size_t, int dowait); void vdsp_mountroot(void *); void vdsp_open(void *, void *); +void vdsp_close(void *, void *); void vdsp_alloc(void *, void *); void vdsp_readlabel(struct vdsp_softc *); int vdsp_writelabel(struct vdsp_softc *); @@ -833,6 +834,8 @@ vdsp_ldc_reset(struct ldc_conn *lc) free(sc->sc_label, M_DEVBUF); sc->sc_label = NULL; } + + workq_add_task(NULL, 0, vdsp_close, sc, NULL); } void @@ -900,7 +903,7 @@ vdsp_open(void *arg1, void *arg2) return; NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, name, p); - error = vn_open(&nd, FREAD, 0); + error = vn_open(&nd, FREAD | FWRITE, 0); if (error) { printf("VOP_OPEN: %s, %d\n", name, error); return; @@ -939,6 +942,18 @@ vdsp_open(void *arg1, void *arg2) } void +vdsp_close(void *arg1, void *arg2) +{ + struct vdsp_softc *sc = arg1; + struct proc *p = curproc; + + if (sc->sc_vp) { + vn_close(sc->sc_vp, FREAD | FWRITE, p->p_ucred, p); + sc->sc_vp = NULL; + } +} + +void vdsp_readlabel(struct vdsp_softc *sc) { struct proc *p = curproc; |