public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jth@kernel.org>
To: Dennis Zhou <dennis@kernel.org>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.com
Subject: Re: memleaks in btrfs-devel/misc-next
Date: Wed, 8 Jan 2020 08:28:12 +0100	[thread overview]
Message-ID: <a1834955-9d1e-2f7b-13e9-7be02bd368fe@kernel.org> (raw)
In-Reply-To: <20200108003104.GA41934@dennisz-mbp.dhcp.thefacebook.com>

Am 08.01.20 um 01:31 schrieb Dennis Zhou:
[...]
> I believe it's because I forgot to put a reference in the relocation
> path. The below seems to fix it in my tests, but would you mind
> verifying?


Thanks for the quick turn around.
Tested-by: Johannes Thumshirn <jth@kernel.org>

@David can you fold this into
63c3d72cf65e ("btrfs: add the beginning of async discard, discard
workqueue")

> --
> From: Dennis Zhou <dennis@kernel.org>
> Date: Tue, 7 Jan 2020 14:14:04 -0800
> Subject: [PATCH] btrfs: put lookup reference in btrfs_relocate_chunk()
>
> Async discard requires looking up the block_group in the relocation path
> to cancel any work items against it. However, I forgot to put the
> reference from btrfs_lookup_block_group().
>
> Reported-by: Johannes Thumshirn <jth@kernel.org>
> Signed-off-by: Dennis Zhou <dennis@kernel.org>
> ---
>  fs/btrfs/volumes.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 65e78e59d5c4..eb55df0d4038 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2898,6 +2898,7 @@ static int btrfs_relocate_chunk(struct btrfs_fs_info *fs_info, u64 chunk_offset)
>  	if (!block_group)
>  		return -ENOENT;
>  	btrfs_discard_cancel_work(&fs_info->discard_ctl, block_group);
> +	btrfs_put_block_group(block_group);
>  
>  	trans = btrfs_start_trans_remove_block_group(root->fs_info,
>  						     chunk_offset);


  reply	other threads:[~2020-01-08  7:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 11:43 memleaks in btrfs-devel/misc-next Johannes Thumshirn
2020-01-07 18:04 ` Dennis Zhou
2020-01-08  0:31 ` Dennis Zhou
2020-01-08  7:28   ` Johannes Thumshirn [this message]
2020-01-08 13:02     ` David Sterba

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=a1834955-9d1e-2f7b-13e9-7be02bd368fe@kernel.org \
    --to=jth@kernel.org \
    --cc=dennis@kernel.org \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@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