xfs
[Top] [All Lists]

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

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/3] xfs: optimize bio handling in the buffer writeback path
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 31 May 2016 11:44:20 -0500
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20160531163118.GA7016@xxxxxxxxxxxxx>
References: <1458128681-10869-1-git-send-email-hch@xxxxxx> <1458128681-10869-4-git-send-email-hch@xxxxxx> <b8d49db2-131d-0735-c803-adec326f43bb@xxxxxxxxxxx> <20160531163118.GA7016@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

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

<Prev in Thread] Current Thread [Next in Thread>