public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 5/5] btrfs-progs: check/lowmem: fix path leakage when dev extents are invalid
Date: Sun, 15 May 2022 21:15:24 +0300	[thread overview]
Message-ID: <53afe0f3-6465-21cf-b7d6-babbadf48860@suse.com> (raw)
In-Reply-To: <4c3548e63a9e42482cbc2c277b15cf3eeae700bd.1652611958.git.wqu@suse.com>



On 15.05.22 г. 13:55 ч., Qu Wenruo wrote:
> [BUG]
> When testing my new RAID56J code, there is a bug causing dev extents
> overlapping.
> 
> Although both modes can detect the problem, lowmem has leaked some
> extent buffers:
> 
>    $ btrfs check --mode=lowmem /dev/test/scratch1
>    Opening filesystem to check...
>    Checking filesystem on /dev/test/scratch1
>    UUID: 65775ce9-bb9d-4f61-a210-beea52eef090
>    [1/7] checking root items
>    [2/7] checking extents
>    ERROR: dev extent devid 1 offset 1095761920 len 1073741824 overlap with previous dev extent end 1096810496
>    ERROR: dev extent devid 2 offset 1351614464 len 1073741824 overlap with previous dev extent end 1352663040
>    ERROR: dev extent devid 3 offset 1351614464 len 1073741824 overlap with previous dev extent end 1352663040
>    ERROR: errors found in extent allocation tree or chunk allocation
>    [3/7] checking free space tree
>    [4/7] checking fs roots
>    [5/7] checking only csums items (without verifying data)
>    [6/7] checking root refs done with fs roots in lowmem mode, skipping
>    [7/7] checking quota groups skipped (not enabled on this FS)
>    found 3221372928 bytes used, error(s) found
>    total csum bytes: 0
>    total tree bytes: 147456
>    total fs tree bytes: 32768
>    total extent tree bytes: 16384
>    btree space waste bytes: 136231
>    file data blocks allocated: 3221225472
>     referenced 3221225472
>    extent buffer leak: start 30752768 len 16384
>    extent buffer leak: start 30752768 len 16384
>    extent buffer leak: start 30752768 len 16384
> 
> [CAUSE]
> In the function check_dev_item(), we iterate through all the dev
> extents, but when we found overlapping extents, we exit without
> releasing the path, causing extent buffer leakage.
> 
> [FIX]
> Just release the path before we exit the function.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>


This can go completely independently from the raid56j code.

  reply	other threads:[~2022-05-15 18:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15 10:54 [PATCH 0/5] btrfs-progs: almost full support for RAID56J profiles Qu Wenruo
2022-05-15 10:54 ` [PATCH 1/5] btrfs-progs: introduce the basic support for RAID56J feature Qu Wenruo
2022-05-15 10:54 ` [PATCH 2/5] btrfs-progs: mkfs: add support for RAID56J creation Qu Wenruo
2022-05-15 10:54 ` [PATCH 3/5] btrfs-progs: check: take per device reservation into consideration Qu Wenruo
2022-05-15 10:54 ` [PATCH 4/5] btrfs-progs: print-tree: add support for per_dev_reserved of chunk item Qu Wenruo
2022-05-15 10:55 ` [PATCH 5/5] btrfs-progs: check/lowmem: fix path leakage when dev extents are invalid Qu Wenruo
2022-05-15 18:15   ` Nikolay Borisov [this message]
2022-05-17 19:03     ` 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=53afe0f3-6465-21cf-b7d6-babbadf48860@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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