[Bug 206328] Crash on shutdown with swap on NFS file
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Jan 17 14:11:42 UTC 2016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206328
--- Comment #2 from Tom Vijlbrief <tvijlbrief at gmail.com> ---
It is not clear to me why swapoff_all is called at the end of bufshutdown(),
probably for a sanity check.
I created two potential quick fixes which work for me,
don't fire the specific KASSERT when rebooting:
*** sys/kern/vfs_bio.c.orig 2016-01-17 14:10:04.000000000 +0100
--- sys/kern/vfs_bio.c 2015-12-22 06:54:16.000000000 +0100
***************
*** 4542,4548 ****
KASSERT(vp->v_type != VCHR && vp->v_type != VBLK,
("Wrong vnode in bufstrategy(bp=%p, vp=%p)", bp, vp));
i = VOP_STRATEGY(vp, bp);
! KASSERT(i == 0 && !rebooting, ("VOP_STRATEGY failed bp=%p vp=%p", bp,
bp->b_vp));
}
void
--- 4542,4548 ----
KASSERT(vp->v_type != VCHR && vp->v_type != VBLK,
("Wrong vnode in bufstrategy(bp=%p, vp=%p)", bp, vp));
i = VOP_STRATEGY(vp, bp);
! KASSERT(i == 0, ("VOP_STRATEGY failed bp=%p vp=%p", bp, bp->b_vp));
}
void
-----8<----------------------
or don't swapoff for special files in swapoff_all() which is only called at the
end of a reboot.
*** sys/vm/swap_pager.c.orig 2016-01-17 14:24:40.000000000 +0100
--- sys/vm/swap_pager.c 2016-01-17 14:59:03.000000000 +0100
***************
*** 2284,2294 ****
mtx_lock(&sw_dev_mtx);
TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) {
mtx_unlock(&sw_dev_mtx);
! if (vn_isdisk(sp->sw_vp, NULL))
devname = devtoname(sp->sw_vp->v_rdev);
! else
devname = "[file]";
! error = swapoff_one(sp, thread0.td_ucred);
if (error != 0) {
printf("Cannot remove swap device %s (error=%d), "
"skipping.\n", devname, error);
--- 2284,2298 ----
mtx_lock(&sw_dev_mtx);
TAILQ_FOREACH_SAFE(sp, &swtailq, sw_list, spt) {
mtx_unlock(&sw_dev_mtx);
! if (vn_isdisk(sp->sw_vp, NULL)) {
devname = devtoname(sp->sw_vp->v_rdev);
! error = swapoff_one(sp, thread0.td_ucred);
! } else {
devname = "[file]";
! error = 0;
! printf("Skip swapoff for (NFS) swap file.\n");
! }
!
if (error != 0) {
printf("Cannot remove swap device %s (error=%d), "
"skipping.\n", devname, error);
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list