From 7d3c02193be873b1bd2cc70f838bd8deb63f0be2 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 4 Feb 2010 16:16:58 -0800 Subject: [PATCH] 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. --- sys/kern/vfs_vopops.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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); } -- 2.41.0