All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: Marc MERLIN <marc@merlins.org>, Chris Murphy <lists@colorremedies.com>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>,
	Chris Mason <clm@fb.com>, <bo.li.liu@oracle.com>,
	<fdmanana@suse.com>, Josef Bacik <jbacik@fb.com>,
	David Sterba <dsterba@suse.cz>
Subject: Re: 4.11 relocate crash, null pointer + rolling back a filesystem by X hours?
Date: Fri, 5 May 2017 10:10:29 +0800	[thread overview]
Message-ID: <6ffe31a5-286e-756e-723c-38eca5c43d35@cn.fujitsu.com> (raw)
In-Reply-To: <cc4ffae2-73d2-70bb-3c6c-0ec6a2bbaf13@cn.fujitsu.com>



At 05/05/2017 09:19 AM, Qu Wenruo wrote:
> 
> 
> At 05/02/2017 11:23 AM, Marc MERLIN wrote:
>> Hi Chris,
>>
>> Thanks for the reply, much appreciated.
>>
>> On Mon, May 01, 2017 at 07:50:22PM -0600, Chris Murphy wrote:
>>> What about btfs check (no repair), without and then also with 
>>> --mode=lowmem?
>>>
>>> In theory I like the idea of a 24 hour rollback; but in normal usage
>>> Btrfs will eventually free up space containing stale and no longer
>>> necessary metadata. Like the chunk tree, it's always changing, so you
>>> get to a point, even with snapshots, that the old state of that tree
>>> is just - gone. A snapshot of an fs tree does not make the chunk tree
>>> frozen in time.
>> Right, of course, I was being way over optimistic here. I kind of forgot
>> that metadata wasn't COW, my bad.
>>
>>> In any case, it's a big problem in my mind if no existing tools can
>>> fix a file system of this size. So before making anymore changes, make
>>> sure you have a btrfs-image somewhere, even if it's huge. The offline
>>> checker needs to be able to repair it, right now it's all we have for
>>> such a case.
>>
>> The image will be huge, and take maybe 24H to make (last time it took
>> some silly amount of time like that), and honestly I'm not sure how
>> useful it'll be.
>> Outside of the kernel crashing if I do a btrfs balance, and hopefully
>> the crash report I gave is good enough, the state I'm in is not btrfs'
>> fault.
>>
>> If I can't roll back to a reasonably working state, with data loss of a
>> known quantity that I can recover from backup, I'll have to destroy and
>> filesystem and recover from scratch, which will take multiple days.
>> Since I can't wait too long before getting back to a working state, I
>> think I'm going to try btrfs check --repair after a scrub to get a list
>> of all the pathanmes/inodes that are known to be damaged, and work from
>> there.
>> Sounds reasonable?
>>
>> Also, how is --mode=lowmem being useful?
>>
>> And for re-parenting a sub-subvolume, is that possible?
>> (I want to delete /sub1/ but I can't because I have /sub1/sub2 that's 
>> also a subvolume
>> and I'm not sure how to re-parent sub2 to somewhere else so that I can 
>> subvolume delete
>> sub1)
>>
>> In the meantime, a simple check without repair looks like this. It will
>> likely take many hours to complete:
>> gargamel:/var/local/space# btrfs check /dev/mapper/dshelf2
>> Checking filesystem on /dev/mapper/dshelf2
>> UUID: 03e9a50c-1ae6-4782-ab9c-5f310a98e653
>> checking extents
>> checksum verify failed on 3096461459456 found 0E6B7980 wanted FBE5477A
>> checksum verify failed on 3096461459456 found 0E6B7980 wanted FBE5477A
>> checksum verify failed on 2899180224512 found 7A6D427F wanted 7E899EE5
>> checksum verify failed on 2899180224512 found 7A6D427F wanted 7E899EE5
>> checksum verify failed on 2899180224512 found ABBE39B0 wanted E0735D0E
>> checksum verify failed on 2899180224512 found 7A6D427F wanted 7E899EE5
>> bytenr mismatch, want=2899180224512, have=3981076597540270796
>> checksum verify failed on 1449488023552 found CECC36AF wanted 199FE6C5
>> checksum verify failed on 1449488023552 found CECC36AF wanted 199FE6C5
>> checksum verify failed on 1449544613888 found 895D691B wanted A0C64D2B
>> checksum verify failed on 1449544613888 found 895D691B wanted A0C64D2B
>> parent transid verify failed on 1671538819072 wanted 293964 found 293902
>> parent transid verify failed on 1671538819072 wanted 293964 found 293902
>> checksum verify failed on 1671603781632 found 18BC28D6 wanted 372655A0
>> checksum verify failed on 1671603781632 found 18BC28D6 wanted 372655A0
>> checksum verify failed on 1759425052672 found 843B59F1 wanted F0FF7D00
>> checksum verify failed on 1759425052672 found 843B59F1 wanted F0FF7D00
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> checksum verify failed on 2898779357184 found 96395131 wanted 433D6E09
>> checksum verify failed on 2898779357184 found 96395131 wanted 433D6E09
>> checksum verify failed on 2899180224512 found 7A6D427F wanted 7E899EE5
>> checksum verify failed on 2899180224512 found 7A6D427F wanted 7E899EE5
>> checksum verify failed on 2899180224512 found ABBE39B0 wanted E0735D0E
>> checksum verify failed on 2899180224512 found 7A6D427F wanted 7E899EE5
>> bytenr mismatch, want=2899180224512, have=3981076597540270796
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> checksum verify failed on 2182657212416 found CD8EFC0C wanted 70847071
>> (...)
> 
> Full output please.

Sorry for not noticing the link.

[Conclusion]
After checking the full result, some of fs/subvolume trees are corrupted.

[Details]
Some example here:

---
ref mismatch on [6674127745024 32768] extent item 0, found 1
Backref 6674127745024 parent 7566652473344 owner 0 offset 0 num_refs 0 
not found in extent tree
Incorrect local backref count on 6674127745024 parent 7566652473344 
owner 0 offset 0 found 1 wanted 0 back 0x5648afda0f20
backpointer mismatch on [6674127745024 32768]
---

The extent at 6674127745024 seems to be an *DATA* extent.
While current default nodesize is 16K and ancient default node is 4K.

Unless you specified -n 32K at mkfs time, it's a DATA extent.

Further more, it's a shared data backref, it's using its parent tree 
block to do backref walk.

And its parent tree block is 7566652473344.
While such bytenr can't be found anywhere (including csum error output), 
that's to say either we can't find that tree block nor can't reach the 
tree root for it.

Considering it's data extent, its owner is either root or fs/subvolume tree.


Such cases are everywhere, as I found other extent sized from 4K to 44K, 
so I'm pretty sure there must be some fs/subvolume tree corrupted.
(Data extent in root tree is seldom 4K sized)

So unfortunately, your fs/subvolume trees are also corrupted.
And almost no chance to do a graceful recovery.

[Alternatives]
I would recommend to use "btrfs restore -f <subvolid>" to restore 
specified subvolume.

What we can do is to try to dump the tree of a subvolume, and manually 
gather what's still here and put them somewhere else.
And that's what btrfs-restore is doing.

The only good new is, your chunk tree seems to be good, so btrfs-restore 
shouldn't encounter too many problems.

Good luck.

Thanks,
Qu

> 
> I know it will be long, but the point here is, full output could help us 
> to at least locate where the most corruption are.
> 
> If most corruption are only in extent tree, the chance to recover will 
> increase hugely.
> 
> As extent tree is just a backref for all allocated extents, it's not 
> really important if recovery (read) is the primary goal.
> 
> But if other tree (fs or subvolume tree important for you) also get 
> corrupted, I'm afraid your last chance will be "btrfs restore" then.
> 
> Thanks,
> Qu
> 
>>
>> Thanks,
>> Marc
>>



  reply	other threads:[~2017-05-05  2:10 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 14:39 4.11.3: BTRFS critical (device dm-1): unable to add free space :-17 => btrfs check --repair runs clean Marc MERLIN
2017-06-20 15:23 ` Hugo Mills
2017-06-20 15:26   ` Marc MERLIN
2017-06-20 15:36     ` Hugo Mills
2017-06-20 15:44       ` Marc MERLIN
2017-06-20 23:12         ` Marc MERLIN
2017-06-20 23:58           ` Marc MERLIN
2017-06-21  3:31           ` Chris Murphy
2017-06-21  3:43             ` Marc MERLIN
2017-06-21 15:13               ` How to fix errors that check --mode lomem finds, but --mode normal doesn't? Marc MERLIN
2017-06-21 23:22                 ` Chris Murphy
2017-06-22  0:48                   ` Marc MERLIN
2017-06-22  2:22                 ` Qu Wenruo
2017-06-22  2:53                   ` Marc MERLIN
2017-06-22  4:08                     ` Qu Wenruo
2017-06-23  4:06                       ` Marc MERLIN
2017-06-23  8:54                         ` Lu Fengqi
2017-06-23 16:17                           ` Marc MERLIN
2017-06-24  2:34                             ` Marc MERLIN
2017-06-26 10:46                               ` Lu Fengqi
2017-06-27 23:11                                 ` Marc MERLIN
2017-06-28  7:10                                   ` Lu Fengqi
2017-06-28 14:43                                     ` Marc MERLIN
2017-05-01 17:06                                       ` 4.11 relocate crash, null pointer Marc MERLIN
2017-05-01 18:08                                         ` 4.11 relocate crash, null pointer + rolling back a filesystem by X hours? Marc MERLIN
2017-05-02  1:50                                           ` Chris Murphy
2017-05-02  3:23                                             ` Marc MERLIN
2017-05-02  4:56                                               ` Chris Murphy
2017-05-02  5:11                                                 ` Marc MERLIN
2017-05-02 18:47                                                   ` btrfs check --repair: failed to repair damaged filesystem, aborting Marc MERLIN
2017-05-03  6:00                                                     ` Marc MERLIN
2017-05-03  6:17                                                       ` Marc MERLIN
2017-05-03  6:32                                                         ` Roman Mamedov
2017-05-03 20:40                                                           ` Marc MERLIN
2017-07-07  5:37                                                   ` ctree.c:197: update_ref_for_cow: BUG_ON `ret` triggered, value -5 Marc MERLIN
2017-07-07  5:39                                                     ` Marc MERLIN
2017-07-07  9:33                                                       ` Lu Fengqi
2017-07-07 16:38                                                         ` Marc MERLIN
2017-07-09  4:34                                                           ` 4.11.6 / more corruption / root 15455 has a root item with a more recent gen (33682) compared to the found root node (0) Marc MERLIN
2017-07-09  5:05                                                             ` We really need a better/working btrfs check --repair Marc MERLIN
2017-07-09  6:34                                                             ` 4.11.6 / more corruption / root 15455 has a root item with a more recent gen (33682) compared to the found root node (0) Marc MERLIN
2017-07-09  7:57                                                             ` Martin Steigerwald
2017-07-09  9:16                                                               ` Paul Jones
2017-07-09 11:17                                                                 ` Duncan
2017-07-09 13:00                                                                   ` Martin Steigerwald
2017-07-29 19:29                                                                   ` Imran Geriskovan
2017-07-29 23:38                                                                     ` Duncan
2017-07-30 14:54                                                                       ` Imran Geriskovan
2017-07-31  4:53                                                                         ` Duncan
2017-07-31 20:32                                                                           ` Imran Geriskovan
2017-08-01  1:36                                                                             ` Duncan
2017-08-01 15:18                                                                               ` Imran Geriskovan
2017-07-31 21:07                                                               ` Ivan Sizov
2017-07-31 21:17                                                                 ` Marc MERLIN
2017-07-31 21:39                                                                   ` Ivan Sizov
2017-08-01 16:41                                                                     ` Ivan Sizov
2017-07-31 22:00                                                                   ` Justin Maggard
2017-08-01  6:38                                                                     ` Marc MERLIN
2017-05-02 19:59                                                 ` 4.11 relocate crash, null pointer + rolling back a filesystem by X hours? Kai Krakow
2017-05-02  5:01                                               ` Duncan
2017-05-02 19:53                                                 ` Kai Krakow
2017-05-23 16:58                                                 ` Marc MERLIN
2017-05-24 10:16                                                   ` Duncan
2017-05-05  1:19                                               ` Qu Wenruo
2017-05-05  2:10                                                 ` Qu Wenruo [this message]
2017-05-05  2:40                                                 ` Marc MERLIN
2017-05-05  5:03                                                   ` Qu Wenruo
2017-05-05 15:43                                                     ` Marc MERLIN
2017-05-17 18:23                                                       ` Kai Krakow
2017-05-05  1:13                                           ` Qu Wenruo
2017-06-29 13:36                                       ` How to fix errors that check --mode lomem finds, but --mode normal doesn't? Lu Fengqi
2017-06-29 15:30                                         ` Marc MERLIN
2017-06-30 14:59                                           ` Lu Fengqi
2017-06-22  4:08                     ` Qu Wenruo
2017-06-21 12:04           ` 4.11.3: BTRFS critical (device dm-1): unable to add free space :-17 => btrfs check --repair runs clean Duncan
2017-06-21  3:26         ` Chris Murphy
2017-06-21  4:06           ` Marc MERLIN

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=6ffe31a5-286e-756e-723c-38eca5c43d35@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=bo.li.liu@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=fdmanana@suse.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    --cc=marc@merlins.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.