Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50B8AC55185 for ; Wed, 22 Apr 2020 22:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3381F20776 for ; Wed, 22 Apr 2020 22:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726224AbgDVW5z (ORCPT ); Wed, 22 Apr 2020 18:57:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:36160 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbgDVW5z (ORCPT ); Wed, 22 Apr 2020 18:57:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 85983ABC7; Wed, 22 Apr 2020 22:57:53 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 629FEDA704; Thu, 23 Apr 2020 00:57:11 +0200 (CEST) Date: Thu, 23 Apr 2020 00:57:11 +0200 From: David Sterba To: Filipe Manana Cc: linux-btrfs Subject: Re: [PATCH v2 1/2] Btrfs: fix memory leak of transaction when deleting unused block group Message-ID: <20200422225711.GV18421@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Filipe Manana , linux-btrfs References: <20200417144012.9269-1-fdmanana@kernel.org> <20200417153615.23832-1-fdmanana@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Tue, Apr 21, 2020 at 09:05:33AM +0100, Filipe Manana wrote: > On Fri, Apr 17, 2020 at 4:38 PM wrote: > > > > From: Filipe Manana > > > > When cleaning pinned extents right before deleting an unused block group, > > we check if there's still a previous transaction running and if so we > > increment its reference count before using it for cleaning pinned ranges > > in its pinned extents iotree. However we ended up never decrementing the > > reference count after using the transaction, resulting in a memory leak. > > > > Fix it by decrementing the reference count. > > > > Signed-off-by: Filipe Manana > > Fixes: fe119a6eeb6705 ("btrfs: switch to per-transaction pinned extents") > > And missed that in v2, but had it in v1. Patch updated, thanks.