Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 May 2013 10:34:26 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Antoine Brodin <antoine@FreeBSD.org>
Cc:        freebsd-fs@freebsd.org, pho@freebsd.org
Subject:   Re: Nullfs - Panic when umounting and lower fs has been removed
Message-ID:  <20130520073426.GY3047@kib.kiev.ua>
In-Reply-To: <CAALwa8nrUbErf9hghdFBOD0Y6yGWD5wYPqQ1Ef4qx_pp7E3Z%2BA@mail.gmail.com>
References:  <CAALwa8nrUbErf9hghdFBOD0Y6yGWD5wYPqQ1Ef4qx_pp7E3Z%2BA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--S41ebxBz2Zis128g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, May 19, 2013 at 08:41:03PM +0000, Antoine Brodin wrote:
> Hi there,
>=20
> I encountered a panic on head today with nullfs using poudriere.
>=20
> It is quite easy to reproduce,  the script is probably doing something
> wrong but panicking is not nice
>=20
> %%%
> mkdir /tmp/.new_packages /mnt/new_packages
> mount -t nullfs /tmp/.new_packages /mnt/new_packages
> dd if=3D/dev/zero of=3D/mnt/new_packages/bar count=3D20000
> mv /tmp/.new_packages/bar /tmp/
> rm -rf /tmp/.new_packages
> umount -f /mnt/new_packages
> %%%
>=20
> The panic:
>=20
> userret: returning with the following locks held:
> exclusive lockmgr ufs (ufs) r =3D 0 (0xfffffe0010a77548) locked @
> /usr/src/sys/modules/nullfs/../../fs/nullfs/null_vnops.c:615
> panic: witness_warn
> cpuid =3D 0
> KDB: enter: panic

This is strange, do you have witness enabled, but invariants not ?

Please try the following change.

diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index ad02236..bece8c8 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -417,8 +417,13 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *=
lowervp)
 	 */
 	if (vp->v_usecount =3D=3D 0) {
 		KASSERT((vp->v_iflag & VI_DOOMED) !=3D 0,
-		    ("not reclaimed %p", vp));
+		    ("not reclaimed nullfs vnode %p", vp));
 		VOP_UNLOCK(vp, 0);
+	} else {
+		ASSERT_VOP_ELOCKED(vp, "unlink_lowervp");
+		KASSERT((vp->v_iflag & VI_DOOMED) =3D=3D 0,
+		    ("reclaimed nullfs vnode %p", vp));
+		xp->null_flags &=3D ~NULLV_NOUNLOCK;
 	}
 	vdrop(vp);
 }

--S41ebxBz2Zis128g
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (FreeBSD)

iQIcBAEBAgAGBQJRmdICAAoJEJDCuSvBvK1BwHIP/3Z4EqI3XBMr1woGPwv4rBw0
z4qg6XLfLbHL8E4q2CQiRvBsdKCyZ3plI7ujwbqXILGsA7lAa+kguKa22vtSq0rn
DPzvoLvzXWmj7iFnzxahPIqnORdat2+0Wx9GanGoQmbDL4s2YvlyBoqES/6wUHS5
ccZpSvSYH1xrdLLr1KB4i6RemG6L3TZ5xRJLG8cf7UVkMq8rbobyylxUpAG4QO9s
EbTS7tjCsobZXdWWN/xAS59bfFdRcAqkc1QYAODSBiCeTLgLX62l2VVu4JgoxMzw
4jbabey3dJhUAHpfbzRevQ3TFB1uIpXMDefWHFwgUDO40g8Wo16ASY+LxKKT/tKS
W0/5fZGAetCt+u+lTKuArwSZ82voWHnmU7oMKCHfdG1gWCtLCmt9IEzKwND4VeAt
jtA7/kZob6dKFND4SNxXGnYrQG29l7r5MFytjkQVB2q7e5Mn+H6tOqP0z37e5KXp
cdThGzRh4AQobwZ/8iBczY3/LKrI7Srj94QbGAaS26KRZF2tmSvXROpg0QQ0hsC5
xHrB7VKJiFacUdgkynnPvhYqPYtrP7YpODu1D6wuqGARPZWJEC62NHwRdNTcvBui
+rZ4dKILgcwsktfRTBmVk9KM0hwLK7yLIg1U/ZfXJOW2glUrgGaGGqpkt0u1JSBZ
jHo0iLRgdSZr8nz71pmt
=Jaw2
-----END PGP SIGNATURE-----

--S41ebxBz2Zis128g--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130520073426.GY3047>