Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Filipe Manana <fdmanana@kernel.org>
Cc: Breno Leitao <leitao@debian.org>, Chris Mason <clm@fb.com>,
	David Sterba <dsterba@suse.com>, Omar Sandoval <osandov@fb.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	jlayton@kernel.org, boris@bur.io, kernel-team@meta.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix extent changeset leak in encoded writes
Date: Fri, 31 Jul 2026 17:04:08 +0200	[thread overview]
Message-ID: <20260731150408.GW10684@twin.jikos.cz> (raw)
In-Reply-To: <CAL3q7H5P6XngF7O8Pfp_WawazCeq26V+=G7OQnnNLsnD4EbZDA@mail.gmail.com>

On Fri, Jul 31, 2026 at 12:56:20PM +0100, Filipe Manana wrote:
> On Fri, Jul 31, 2026 at 12:52 PM Breno Leitao <leitao@debian.org> wrote:
> >
> > Investigating some machines with kmemleak, I am constantly seeing
> > the following memory leak that seems real.
> >
> >   kmemleak: unreferenced object 0xffff88869f7d01c0 (size 64):
> >   kmemleak:   comm "btrfs", pid 1613416, jiffies 4316358595
> >   kmemleak:   backtrace (crc ab59040a):
> >   kmemleak:     __kmalloc_cache_noprof
> >   kmemleak:     qgroup_reserve_data
> >   kmemleak:     btrfs_qgroup_reserve_data
> >   kmemleak:     btrfs_do_encoded_write
> >   kmemleak:     btrfs_do_write_iter
> >   kmemleak:     btrfs_ioctl_encoded_write
> >   kmemleak:     btrfs_ioctl
> >   kmemleak:   ... and 2 more object(s) with the same backtrace
> >
> > and
> >
> >   kmemleak: unreferenced object 0xffff88830d94edc0 (size 64):
> >   kmemleak:   comm "btrfs", pid 1613416, jiffies 4316358595
> > <snip>
> >   kmemleak:   ... and 2 more object(s) with the same backtrace
> >
> > Looking at the code, it seems we don't free data_reserved, but
> > we should (!?). I was able to come up with a xfstest test that exposes
> > the kmemleak above:
> >
> > https://github.com/leitao/xfstest/commit/81c83a3fbb20b4ad695055ede7fcb73d3ffa2e52
> >
> > Free the changeset on the way out, as every other caller of
> > btrfs_qgroup_reserve_data() already does.
> >
> > Fixes: 7c0c7269f7b5 ("btrfs: add BTRFS_IOC_ENCODED_WRITE")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> 
> This is already fixed here:
> 
> https://lore.kernel.org/linux-btrfs/20260727115352.12622-1-dmantipov@yandex.ru/

Will be sent next week.

      reply	other threads:[~2026-07-31 15:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 11:45 [PATCH] btrfs: fix extent changeset leak in encoded writes Breno Leitao
2026-07-31 11:56 ` Filipe Manana
2026-07-31 15:04   ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260731150408.GW10684@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=boris@bur.io \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osandov@fb.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox