[issue1276] panic: assertion: volume->io.lock.refs == 0 in hammer_unload_volume

Matthew Dillon dillon at apollo.backplane.com
Mon Feb 16 15:03:39 PST 2009

:Thomas Nikolajsen <thomas.nikolajsen at mail.dk> added the comment:
:New crash dump using HEAD of Feb 12, 2009.
:Uploading to leaf as *.29 (with all modules in use).
: -thomas

    Thomas, I believe I have found it.  Please try the enclosed patch.
    When a buffer collision occurs under heavy loads a ref on the volume
    structure was not being undone, leading to a ref count leak on the
    volume structure which will result in a panic on umount.

    This fix will not make it into 2.2.  It needs to be tested and verified
    to have fixed the problem, then I'll commit and MFC it.
					Matthew Dillon 
					<dillon at backplane.com>

diff --git a/sys/vfs/hammer/hammer_ondisk.c b/sys/vfs/hammer/hammer_ondisk.c
index 711fe65..214e1ff 100644
--- a/sys/vfs/hammer/hammer_ondisk.c
+++ b/sys/vfs/hammer/hammer_ondisk.c
@@ -639,8 +639,10 @@ again:
 	 * Insert the buffer into the RB tree and handle late collisions.
 	if (RB_INSERT(hammer_buf_rb_tree, &hmp->rb_bufs_root, buffer)) {
-		hammer_unref(&buffer->io.lock);
+		hammer_unref(&buffer->io.lock);	/* safety */
+		hammer_rel_volume(volume, 0);
+		buffer->io.volume = NULL;	/* safety */
 		kfree(buffer, hmp->m_misc);
 		goto again;

More information about the Bugs mailing list