Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jan 2016 14:11:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 206328] Crash on shutdown with swap on NFS file
Message-ID:  <bug-206328-8-sYFKN1VJYi@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-206328-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-206328-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206328

--- Comment #2 from Tom Vijlbrief <tvijlbrief@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 !=3D VCHR && vp->v_type !=3D VBLK,
            ("Wrong vnode in bufstrategy(bp=3D%p, vp=3D%p)", bp, vp));
        i =3D VOP_STRATEGY(vp, bp);
!       KASSERT(i =3D=3D 0 && !rebooting, ("VOP_STRATEGY failed bp=3D%p vp=
=3D%p", bp,
bp->b_vp));
  }

  void
--- 4542,4548 ----
        KASSERT(vp->v_type !=3D VCHR && vp->v_type !=3D VBLK,
            ("Wrong vnode in bufstrategy(bp=3D%p, vp=3D%p)", bp, vp));
        i =3D VOP_STRATEGY(vp, bp);
!       KASSERT(i =3D=3D 0, ("VOP_STRATEGY failed bp=3D%p vp=3D%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 =3D devtoname(sp->sw_vp->v_rdev);
!               else
                        devname =3D "[file]";
!               error =3D swapoff_one(sp, thread0.td_ucred);
                if (error !=3D 0) {
                        printf("Cannot remove swap device %s (error=3D%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 =3D devtoname(sp->sw_vp->v_rdev);
!                       error =3D swapoff_one(sp, thread0.td_ucred);
!               } else {
                        devname =3D "[file]";
!                       error =3D 0;
!                       printf("Skip swapoff for (NFS) swap file.\n");
!               }
!=20
                if (error !=3D 0) {
                        printf("Cannot remove swap device %s (error=3D%d), "
                            "skipping.\n", devname, error);

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206328-8-sYFKN1VJYi>