[PATCH 3/3] xfs: optimize bio handling in the buffer writeback path

Eric Sandeen sandeen at sandeen.net
Tue May 31 11:44:20 CDT 2016



On 5/31/16 11:31 AM, Christoph Hellwig wrote:
> On Tue, May 31, 2016 at 10:35:01AM -0500, Eric Sandeen wrote:
>> Coverity thinks this is problematic, calling it a
>> "Free of address-of expression (BAD_FREE)"
>>
>> CID 1362192
>>
>> The issue is that if bio still == io_inline_bio, we are freeing
>> memory which was not allocated.
> 
> No, we free the ioend into which the bio is embedded.  Take a look
> at the allocation side in xfs_alloc_ioend:
> 
> 	bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, xfs_ioend_bioset);
> 
> 	ioend = container_of(bio, struct xfs_ioend, io_inline_bio);
> 
> 
>> Maybe this needs a:
>>
>> if (bio != &ioend->io_inline_bio)
>> 	bio_put(bio);
> 
> That would leak every ioend used.
> 
>> or is there a better way?
> 
> We just need to shut up the checker..

Hrmph, I guess I have misunderstood what's going on.  :/  Sorry.

-Eric



More information about the xfs mailing list