From 412a8eabf4c05830e92d0fb5ff63480820690baf Mon Sep 17 00:00:00 2001 From: jsing Date: Tue, 15 Dec 2009 13:04:04 +0000 Subject: Explicitly lock the vnode when deleting a volume. This avoids a potential panic that is caused by vnode aliasing, where checkalias() switches the vnode ops for our vnode. This means that we end up using ufs unlocking rather than specfs unlocking (which is a no-op). ok marco@ --- sys/dev/softraid.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/dev/softraid.c') diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 48645afc4eb..edf333f6276 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.184 2009/12/07 14:33:38 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.185 2009/12/15 13:04:04 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom * Copyright (c) 2008 Chris Kuethe @@ -3152,6 +3152,12 @@ sr_chunks_unwind(struct sr_softc *sc, struct sr_chunk_head *cl) DNPRINTF(SR_D_IOCTL, "%s: sr_chunks_unwind closing: %s\n", DEVNAME(sc), ch_entry->src_devname); if (ch_entry->src_vn) { + /* + * XXX - explicitly lock the vnode until we can resolve + * the problem introduced by vnode aliasing... specfs + * has no locking, whereas ufs/ffs does! + */ + vn_lock(ch_entry->src_vn, LK_EXCLUSIVE | LK_RETRY, 0); VOP_CLOSE(ch_entry->src_vn, FREAD | FWRITE, NOCRED, 0); vput(ch_entry->src_vn); } -- cgit v1.2.3-59-g8ed1b