Re: [PATCH] block: call __bio_free in bio_endio
From: Christoph Hellwig <hch@lst.de>
Date: 2017-06-29 20:24:05
From: Christoph Hellwig <hch@lst.de>
Date: 2017-06-29 20:24:05
On Thu, Jun 29, 2017 at 11:54:17AM -0700, Shaohua Li wrote:
bio_free isn't a good place to free cgroup info. There are a lot of cases bio is allocated in special way (for example, in stack) and never gets called by bio_put hence bio_free, we are leaking memory. This patch moves the free to bio endio, which should be called anyway. The __bio_free call in bio_free is kept, in case the bio never gets called bio endio.
Jens already renamed __bio_free to bio_uninit in Linus' tree. That being said I think we should just kill __bio_free once all the work is in. But I think we should defer this post the initial pull for 4.12-rc to reduce the merge pain.