public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: dsterba@suse.cz, Qu Wenruo <quwenruo.btrfs@gmx.com>,
	linux-btrfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>,
	Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH v4 2/4] btrfs: extent-tree: Kill BUG_ON() in __btrfs_free_extent() and do better comment
Date: Fri, 14 Aug 2020 16:07:10 +0800	[thread overview]
Message-ID: <4d1a93dd-b90b-82cc-3e0c-39e658bfbf2e@suse.com> (raw)
In-Reply-To: <20200814080124.GT2026@twin.jikos.cz>



On 2020/8/14 下午4:01, David Sterba wrote:
> On Fri, Aug 14, 2020 at 08:52:19AM +0800, Qu Wenruo wrote:
>>
>>
>> On 2020/8/13 下午10:10, David Sterba wrote:
>>> On Wed, Aug 12, 2020 at 02:05:07PM +0800, Qu Wenruo wrote:
>>>> @@ -2987,13 +3049,20 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
>>>>  				found_extent = 1;
>>>>  				break;
>>>>  			}
>>>> +
>>>> +			/* Quick path didn't find the EXTEMT/METADATA_ITEM */
>>>>  			if (path->slots[0] - extent_slot > 5)
>>>>  				break;
>>>>  			extent_slot--;
>>>>  		}
>>>>
>>>>  		if (!found_extent) {
>>>> -			BUG_ON(iref);
>>>> +			if (unlikely(iref)) {
>>>> +				btrfs_crit(info,
>>>> +"invalid iref, no EXTENT/METADATA_ITEM found but has inline extent ref");
>>>> +				goto err_dump_abort;
>>>
>>> This is not calling transaction abort at the place where it happens,
>>> here and several other places too.
>>
>> Did you mean, we want the btrfs_abort_transaction() call not merged
>> under one tag, so that we can get the kernel warning with the line number?
>>
>> If so, that's indeed the case, we lose the exact line number.
>>
>> But we still have the unique error message to locate the problem without
>> much hassle (it's less obvious than the line number thought).
>>
>> Thus to me, we don't lose much debug info anyway.
> 
> https://btrfs.wiki.kernel.org/index.php/Development_notes#Error_handling_and_transaction_abort
> 
> "Please keep all transaction abort exactly at the place where they happen
> and do not merge them to one. This pattern should be used everwhere and
> is important when debugging because we can pinpoint the line in the code
> from the syslog message and do not have to guess which way it got to the
> merged call."
> 
> It's very convenient to paste the file:line number from a stacktrace
> report and land exactly in the spot where it failed.
> 
OK, makse sense.

Will go that direction in next update.

Thanks,
Qu


  reply	other threads:[~2020-08-14  8:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12  6:05 [PATCH v4 0/4] btrfs: Enhanced runtime defence against fuzzed images Qu Wenruo
2020-08-12  6:05 ` [PATCH v4 1/4] btrfs: extent_io: Do extra check for extent buffer read write functions Qu Wenruo
2020-08-13 14:05   ` David Sterba
2020-08-14  0:47     ` Qu Wenruo
2020-08-14 10:29       ` David Sterba
2020-08-12  6:05 ` [PATCH v4 2/4] btrfs: extent-tree: Kill BUG_ON() in __btrfs_free_extent() and do better comment Qu Wenruo
2020-08-13 14:10   ` David Sterba
2020-08-14  0:52     ` Qu Wenruo
2020-08-14  8:01       ` David Sterba
2020-08-14  8:07         ` Qu Wenruo [this message]
2020-08-12  6:05 ` [PATCH v4 3/4] btrfs: extent-tree: Kill the BUG_ON() in insert_inline_extent_backref() Qu Wenruo
2020-08-12  6:05 ` [PATCH v4 4/4] btrfs: ctree: Checking key orders before merged tree blocks Qu Wenruo
2020-08-13 14:21   ` David Sterba
2020-08-14  0:54     ` Qu Wenruo
2020-08-14  7:58       ` David Sterba
2020-08-12  6:52 ` [PATCH v4 0/4] btrfs: Enhanced runtime defence against fuzzed images 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=4d1a93dd-b90b-82cc-3e0c-39e658bfbf2e@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.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