Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751656AbdF1Swm (ORCPT ); Wed, 28 Jun 2017 14:52:42 -0400 Received: from verein.lst.de ([213.95.11.211]:50995 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbdF1Swh (ORCPT ); Wed, 28 Jun 2017 14:52:37 -0400 Date: Wed, 28 Jun 2017 20:52:35 +0200 From: Christoph Hellwig To: Jens Axboe Cc: Christoph Hellwig , Keith Busch , wenxiong@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, bjking@linux.vnet.ibm.com Subject: Re: [PATCH] fs: System memory leak when running HTX with T10 DIF enabled Message-ID: <20170628185235.GA13126@lst.de> References: <1498667571-14275-1-git-send-email-wenxiong@linux.vnet.ibm.com> <20170628171031.GC2650@localhost.localdomain> <20170628183141.GA12722@lst.de> <0fa90019-5b07-7afb-8915-17c54a22709b@fb.com> <20170628183818.GA12860@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1486 Lines: 36 On Wed, Jun 28, 2017 at 12:44:00PM -0600, Jens Axboe wrote: > On 06/28/2017 12:38 PM, Christoph Hellwig wrote: > > On Wed, Jun 28, 2017 at 12:34:15PM -0600, Jens Axboe wrote: > >> That's what I sent out. > > > > Where? Didn't see that anywhere.. > > Looks like you weren't CC'ed on the original thread. About an hour ago. > > >> Here it is again. We should get this into 4.12, > >> so would be great with a review or two. > > > > Can we rename __bio_free to bio_uninit and add a comment to bio_init > > that it must be paried with bio_uninit? > > Let's keep it small for 4.12. We can do a cleanup on top of this for > 4.13. The rename is two additional lines for the patch, it's not going to make a difference.. > > Except for that this looks fine, although there are a lot more callers > > that should get this treatment.. > > Should only be an issue for on-stack bio's, since we don't go through > the put/free path. Did a quick grep, looks like this is one of 3. One > is floppy, which probably neither has DIF or uses blk-throttle. Then > there's one in dm-bufio, didn't look too closely at that. Last one is > this one. Well, it's really all callers but bio_alloc_bioset itself that will need this handling, as only bios that come from bio_alloc_bioset will be freed through bio_free. Most of them probably don't support DIF, but they'll also miss the bio_disassociate_task call this way, and will leak I/O context and css references if block cgroup support is enabled.