linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, Chandan Rajendra <chandan@linux.vnet.ibm.com>,
	<linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v11 00/13] Btrfs dedupe framework
Date: Fri, 24 Jun 2016 10:50:41 +0800	[thread overview]
Message-ID: <023d6b07-2326-bc48-188e-21ff8a442304@cn.fujitsu.com> (raw)
In-Reply-To: <20160623121738.GZ4915@twin.jikos.cz>

Hi Chandan, David,

When I'm trying to rebase dedupe patchset on top of Chadan's sub page 
size patchset (using David's for-next-test-20160620), although the 
rebase itself is quite simple, but I'm afraid that I found some bugs for 
sub page size patchset, *without* dedupe patchset applied.

These bugs seems to be unrelated to each other
1) state leak at btrfs rmmod time
2) bytes_may_use leak at qgroup EDQUOTA error time
3) selftest is run several times at modules load time
    15 times, to be more exact
    And since I didn't found any immediate number related to run it 15
    times, I assume at least it's not designed to do it 15 times.

The reproducer for 1) and 2) is quite simple, extracted from btrfs/022 
test case:
------
dev=/dev/sdb5
mnt=/mnt/test

umount $dev &> /dev/null

mkfs.btrfs $dev -f
mount $dev $mnt -o nospace_cache
btrfs dedupe enable $mnt
btrfs sub create $mnt/sub
btrfs quota enable $mnt


# Just use small limit, making ftrace less noise.
btrfs qgroup limit 512K 0/257 $mnt
dd if=/dev/urandom of=$mnt/sub/test bs=1M count=1
umount $mnt
rmmod btrfs
------

At unmount time, kernel warning will happen due to may_use bytes leak.
I could dig it further, as it looks like a bug in space reservation 
failure case.
------
BTRFS: space_info 1 has 8044544 free, is not full
BTRFS: space_info total=8388608, used=344064, pinned=0, reserved=0, 
may_use=409600, readonly=0
------

And at rmmod time, btrfs will detect extent_state leak, whose length is 
always 4095 (page size - 1).

Hope this will help, and I'm willing to help to fix the problem.

Thanks,
Qu

At 06/23/2016 08:17 PM, David Sterba wrote:
> On Tue, Jun 21, 2016 at 10:25:19PM +0530, Chandan Rajendra wrote:
>>>> I'm completely OK to do the rebase, but since I don't have 64K page size
>>>> machine to test the rebase, we can only test if 4K system is unaffected.
>>>>
>>>> Although not much help, at least it would be better than making it compile.
>>>>
>>>> Also such rebase may help us to expose bad design/unexpected corner case
>>>> in dedupe.
>>>> So if it's OK, please let me try to do the rebase.
>>>
>>> Well, if you base dedupe on subpage, then it could be hard to find the
>>> patchset that introduces bugs, or combination of both. We should be able
>>> to test the features independently, and thus I'm proposing to first find
>>> some common patchset that makes that possible.
>>
>> I am not sure if I understood the above statement correctly. Do you mean to
>> commit the 'common/simple' patches from both the subpage-blocksize & dedupe
>> patchset first and then bring in the complicated ones later?
>
> That would be great yes, but ...
>
>> If yes, then we have a problem doing that w.r.t subpage-blocksize
>> patchset. The first few patches bring in the core changes necessary for the
>> other remaining patches.
>
> ... not easily possible. I looked again for common functions that change
> the singature and found only cow_file_range and run_delalloc_nocow. The
> plan:
>
> - separate patch that adds new parameters required by both patches to
>   the functions
> - update all call sites, add 0/NULL as defaults for the new unused
>   parameters
> - rebase both patches on top of this patch
>
> How does this help: if a patch starts to use the new parameter, it
> changes only the value at all call sites. This is much easier to verify
> and merge manually compared to adding a new parameter to the middle of
> the list, namely when the functions take 6+.
>
> The other conflicts like conversion from PAGE_SIZE to the the block
> oriented iterations will be harder, but these are usually localized and
> can be resolved. We'll see if there are other options to reduce the
> clashes but at the moment it's stuck at the two functions. Does that
> explain it better?
>
>



  reply	other threads:[~2016-06-24  2:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15  2:09 [PATCH v11 00/13] Btrfs dedupe framework Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 01/13] btrfs: dedupe: Introduce dedupe framework and its header Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 02/13] btrfs: dedupe: Introduce function to initialize dedupe info Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 03/13] btrfs: dedupe: Introduce function to add hash into in-memory tree Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 04/13] btrfs: dedupe: Introduce function to remove hash from " Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 05/13] btrfs: delayed-ref: Add support for increasing data ref under spinlock Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 06/13] btrfs: dedupe: Introduce function to search for an existing hash Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 07/13] btrfs: dedupe: Implement btrfs_dedupe_calc_hash interface Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 08/13] btrfs: ordered-extent: Add support for dedupe Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 09/13] btrfs: dedupe: Inband in-memory only de-duplication implement Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 10/13] btrfs: dedupe: Add ioctl for inband dedupelication Qu Wenruo
2016-06-15  2:09 ` [PATCH v11 11/13] btrfs: relocation: Enhance error handling to avoid BUG_ON Qu Wenruo
2016-06-15  2:10 ` [PATCH v11 12/13] btrfs: improve inode's outstanding_extents computation Qu Wenruo
2016-06-15  2:10 ` [PATCH v11 13/13] btrfs: dedupe: fix false ENOSPC Qu Wenruo
2016-06-15  3:11   ` kbuild test robot
2016-06-15  3:17   ` [PATCH v11.1 " Qu Wenruo
2016-06-15  3:26   ` [PATCH v11 " kbuild test robot
2016-06-20 16:03 ` [PATCH v11 00/13] Btrfs dedupe framework David Sterba
2016-06-21  0:36   ` Qu Wenruo
2016-06-21  9:13     ` David Sterba
2016-06-21  9:26       ` Qu Wenruo
2016-06-21  9:34         ` David Sterba
2016-06-21 16:55           ` Chandan Rajendra
2016-06-23 12:17             ` David Sterba
2016-06-24  2:50               ` Qu Wenruo [this message]
2016-06-24  4:34                 ` Chandan Rajendra
2016-06-24  9:29                 ` Chandan Rajendra
2016-06-25  1:22                   ` Qu Wenruo
2016-06-25  5:45                     ` Chandan Rajendra
2016-06-27  3:04                       ` Qu Wenruo
2016-06-24  4:10               ` Chandan Rajendra
2016-06-22  1:48 ` Qu Wenruo
2016-06-24  6:54   ` Satoru Takeuchi
2016-06-24  8:30     ` Qu Wenruo

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=023d6b07-2326-bc48-188e-21ff8a442304@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=chandan@linux.vnet.ibm.com \
    --cc=dsterba@suse.cz \
    --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;
as well as URLs for NNTP newsgroup(s).