From: Matthew Dillon Date: Fri, 5 Feb 2010 00:16:58 +0000 (-0800) Subject: kernel - fix panic on reboot when swap populated X-Git-Tag: v2.7.1~229^2~12 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/7d3c02193be873b1bd2cc70f838bd8deb63f0be2 kernel - fix panic on reboot when swap populated * The swapvp does not have a v_mount so do not try to access the mount lock through it if v_mount is NULL. --- diff --git a/sys/kern/vfs_vopops.c b/sys/kern/vfs_vopops.c index de8130d717..918d8f3983 100644 --- a/sys/kern/vfs_vopops.c +++ b/sys/kern/vfs_vopops.c @@ -818,9 +818,16 @@ vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio) ap.a_vp = vp; ap.a_bio = bio; - VFS_MPLOCK1(vp->v_mount); - DO_OPS(ops, error, &ap, vop_strategy); - VFS_MPUNLOCK(vp->v_mount); + if (vp->v_mount) { + VFS_MPLOCK1(vp->v_mount); + DO_OPS(ops, error, &ap, vop_strategy); + VFS_MPUNLOCK(vp->v_mount); + } else { + /* ugly hack for swap */ + get_mplock(); + DO_OPS(ops, error, &ap, vop_strategy); + rel_mplock(); + } return(error); }