kernel - Work through some memory leaks in dsched
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 24 Sep 2010 00:15:07 +0000 (17:15 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 24 Sep 2010 00:15:07 +0000 (17:15 -0700)
commitb5d7061d1ace7a0b0583af8ceae683dbd3e9bc81
tree484fb93cc66f9939fd86831d142a11233e87c442
parentf1eeacbe93bb5baefacf1e0fb1de6334be72829e
kernel - Work through some memory leaks in dsched

* Add a uninitbufbio() function to complement initbufbio().  Also move
  BUF_LOCKINIT() into initbufbio() and BUF_LOCKFREE() into uninitbufbio().

* There are several device drivers and other places where the struct buf
  is still being allocated manually (verses using getpbuf()).  These were
  kfree()ing the buffer without dealing with e.g. dsched_exit_buf().

  Have uninitbufbio() call dsched_exit_buf() and adjust the various manual
  allocations/frees of struct buf to call uninitbufbio() before kfree()ing.
  Also remove various manual calls to BUF_LOCKFREE() (which is now done
  inside uninitbufbio()).

* This should hopefully deal with the memory leaks but there could be a
  few left.

Reported-by: "Steve O'Hara-Smith" <steve@sohara.org>
sys/dev/disk/ata/ata-raid.c
sys/dev/disk/ccd/ccd.c
sys/dev/disk/nata/ata-raid.c
sys/dev/raid/vinum/vinuminterrupt.c
sys/dev/raid/vinum/vinumrequest.c
sys/kern/kern_dsched.c
sys/kern/vfs_bio.c
sys/sys/buf.h
sys/vfs/devfs/devfs_vnops.c