Skip to content

Commit

Permalink
HAMMER VFS: Add missing hammer_rel_volume() call in deadlock/retry case.
Browse files Browse the repository at this point in the history
A late collision in hammer_get_buffer() could result in a ref count leak
on a hammer_volume structure.  Fix the leak.
  • Loading branch information
Matthew Dillon authored and Thomas Nikolajsen committed Apr 22, 2009
1 parent 31e1739 commit 015c7d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/vfs/hammer/hammer_ondisk.c
Expand Up @@ -639,8 +639,10 @@ hammer_get_buffer(hammer_mount_t hmp, hammer_off_t buf_offset,
* 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_count_buffers;
hammer_rel_volume(volume, 0);
buffer->io.volume = NULL; /* safety */
kfree(buffer, hmp->m_misc);
goto again;
}
Expand Down

0 comments on commit 015c7d5

Please sign in to comment.