Date: Sat, 17 May 2014 22:22:29 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Benjamin Kaduk <bjk@freebsd.org> Cc: freebsd-fs@freebsd.org Subject: Re: Add an assert that v_holdcnt >= v_usecount? Message-ID: <20140517192229.GA74331@kib.kiev.ua> In-Reply-To: <alpine.GSO.1.10.1405171326480.25244@multics.mit.edu> References: <alpine.GSO.1.10.1405171326480.25244@multics.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--o8B5w8807wLEcI70 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 17, 2014 at 01:48:11PM -0400, Benjamin Kaduk wrote: > jhb was helping me debug a crashy openafs build in one of my VMs, and the= =20 > symptoms seemed to indicate that a vnode had been partially destroyed=20 > before vgone() was called from vflush(), as if some buggy filesystem code= =20 > had called vdrop() instead of vrele() or something similar. In a quick= =20 > check, it didn't look like we had any assertions that would catch such=20 > bugs, so I tried adding something like this: >=20 > Index: sys/kern/vfs_subr.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/kern/vfs_subr.c (revision 266330) > +++ sys/kern/vfs_subr.c (working copy) > @@ -2343,6 +2343,8 @@ > if (vp->v_holdcnt <=3D 0) > panic("vdrop: holdcnt %d", vp->v_holdcnt); > vp->v_holdcnt--; > + VNASSERT(vp->v_holdcnt >=3D vp->v_usecount, vp, > + ("hold count less than use count")); > if (vp->v_holdcnt > 0) { > VI_UNLOCK(vp); > return; >=20 > Does that seem like something that would be generally useful? This is reasonable. As a note, I never seen such corruption of the otherwise valid vnode state= =20 ever. There were a lot of leaks, but never mismatched vget/vdrop. --o8B5w8807wLEcI70 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJTd7b1AAoJEJDCuSvBvK1B9C8P/jawSVLbXjzWqD5rjdUCoJ+k 3XaEe4uokIf9yOxbZ2sAlq9rDQahgL8xABCfHfY/FSCMOfWmmyx10Kb/CFZfpajV cqpzxPNj9oshdxKcYYqrbSji//vZBovby1/RIfzcvXkCKnBGv09oJts56jw0ZORv QjEdDj12vbtDfyhzffPl68vYBg4TFQDzmSOuhg2cf8iCJcdsN8+XEdG3Ln6OMGsf NOLePIJy3b+ioJocakthzVj+ITnpEYp258U5WeZSd2wdbDSZ0wIxEt6r1pt4Mhua RdUCr8QFOST5vm1lAPk7x8KByOyrCk1tOibSnnKJn2z2oO1OOw9ngURI1PwVDf+l 3YCjGJhA0yXbBFC4Se82kD0NqXmR9sX+z7MuAu+FXnHGnjknPb/xpZ+O37R5dk6Y g6C1ZvwmDguOtK7VjpixD+jl+YjhMKEUJzAFwy5FYq8WEMA/x2qClK+/4R8sg4xD PLi57oSdDABCEZhVmThDIbf5BlfAox1WcONCEIrs7cS++SiGBzmN+gl+j0YjCDns dNCkKAoKtOsYPfSK/yIeMdxuWsLMqODsSI8mZeiK4pE2SDNCCkntSxoMmXZfhvbR AEY+RRYoPUuPhC/Wie2IR44k8Pg8GMrrKT5xaUlmj/GjhOFnW4OG8nASE+wR2OCk P0B2by5Ntez80E/7GOBg =N3p7 -----END PGP SIGNATURE----- --o8B5w8807wLEcI70--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140517192229.GA74331>