diff options
author | 2009-12-15 13:04:04 +0000 | |
---|---|---|
committer | 2009-12-15 13:04:04 +0000 | |
commit | 412a8eabf4c05830e92d0fb5ff63480820690baf (patch) | |
tree | 5794e98aa94e73fe7e178e1000962e2783252933 /sys/dev/softraid.c | |
parent | Simplify SSL code client-side, no functional change. (diff) | |
download | wireguard-openbsd-412a8eabf4c05830e92d0fb5ff63480820690baf.tar.xz wireguard-openbsd-412a8eabf4c05830e92d0fb5ff63480820690baf.zip |
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@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r-- | sys/dev/softraid.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -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); } |