summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2005-05-24 04:45:14 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2005-05-24 04:45:14 +0000
commit7bdbcab47401a1871cac32b6f1e10554b24fda36 (patch)
tree187b43b8152fb9b0937c0badcb87a48aea8ad9e1 /sys/miscfs
parent4a7a3fe8c5220fa6fc02ef5c473e5fbccae9185f (diff)
better handling of disappearing devices, in spec_close(), don't try to
double-lock the vnode if we're coming from vclean()
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/specfs/spec_vnops.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 91861a87d57..c17f2af5740 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spec_vnops.c,v 1.28 2004/11/29 17:05:05 grange Exp $ */
+/* $OpenBSD: spec_vnops.c,v 1.29 2005/05/24 04:45:13 pedro Exp $ */
/* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */
/*
@@ -636,11 +636,15 @@ spec_close(v)
/*
* On last close of a block device (that isn't mounted)
* we must invalidate any in core blocks, so that
- * we can, for instance, change floppy disks.
+ * we can, for instance, change floppy disks. In order to do
+ * that, we must lock the vnode. If we are coming from
+ * vclean(), the vnode is already locked.
*/
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, ap->a_p);
+ if (!(vp->v_flag & VXLOCK))
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, ap->a_p);
error = vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 0, 0);
- VOP_UNLOCK(vp, 0, ap->a_p);
+ if (!(vp->v_flag & VXLOCK))
+ VOP_UNLOCK(vp, 0, ap->a_p);
if (error)
return (error);
/*