On 2019/2/14 下午7:58, Jesper Utoft wrote:
> Hello Fellow BTRFS users.
>
> I have run into the bad key order issue.
> corrupt leaf: root=1 block=57567265079296 slot=83, bad key order, prev
> (18446744073709551605 0 57707594776576) current (18446726481523507189
> 0 57709742260224)
> The lines repeats over and over..
>
> I read a thread between Hugo Mills and Eric Wolf about a similar issue
> and i have gathered the same info.
Now we have all the needed info.
>
> I understand that it probably is hardware related, i have been running
> memtest for 60h+ to see if i could reproduce it.
> I also tried to run btrfs check --recover but it did not help.
>
> My questions is if it can be fixed?
Yes, but only manual patching is possible yet.
[snip]
> [ 550.070483] BTRFS critical (device sdc4): corrupt leaf: root=1
> block=57567265079296 slot=83, bad key order, prev
> (18446744073709551605 0 57707594776576) current (18446726481523507189
> 0 57709742260224)
> [ 550.070569] BTRFS warning (device sdc4): btrfs_uuid_scan_kthread failed -5
>
> Debug info:
> sudo btrfs inspect-internal dump-tree -b 57567265079296 --follow /dev/sda4
> btrfs-progs v4.16.1
> leaf 57567265079296 items 246 free space 47 generation 7325984 owner ROOT_TREE
> leaf 57567265079296 flags 0x1(WRITTEN) backref revision 1
> fs uuid 90900a21-8a71-4301-b5c2-21dea31f1132
> chunk uuid b3eed334-68af-43e6-ae1e-c05e504f30cf
> item 0 key (FREE_SPACE UNTYPED 57557270921216) itemoff 16242 itemsize 41
> location key (74274 INODE_ITEM 0)
> cache generation 7325984 entries 308 bitmaps 8
> item 1 key (FREE_SPACE UNTYPED 57558344663040) itemoff 16201 itemsize 41
> location key (74275 INODE_ITEM 0)
> cache generation 7325984 entries 338 bitmaps 8
> ... [snip] ...
> item 81 key (FREE_SPACE UNTYPED 57705447292928) itemoff 12921 itemsize 41
> location key (74392 INODE_ITEM 0)
> cache generation 2530576 entries 0 bitmaps 0
> item 82 key (FREE_SPACE UNTYPED 57707594776576) itemoff 12880 itemsize 41
> location key (74393 INODE_ITEM 0)
> cache generation 2530576 entries 0 bitmaps 0
> item 83 key (18446726481523507189 UNKNOWN.0 57709742260224) itemoff 12839 itemsize 41
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thankfully, all keys around give us a pretty good idea what the original
value should be: (FREE_SPACE UNTYPED 57709742260224).
And for the raw value:
bad: 0xffffeffffffffff5
good: 0xfffffffffffffff5
^
e->f, one bit get flipped.
(UNTYPED is the same value for UNKNOWN.0, so don't worry about that).
I have created a special branch for you:
https://github.com/adam900710/btrfs-progs/tree/dirty_fix
Just compile that btrfs-progs, no need to install, then excute the
following command inside btrfs-progs directory:
# ./btrfs-corrupt-block -X <device>
And your report just remind me to update the write time tree block
checker....
Thanks,
Qu
> item 84 key (FREE_SPACE UNTYPED 57711889743872) itemoff 12798 itemsize 41
> location key (74395 INODE_ITEM 0)
> cache generation 2530576 entries 0 bitmaps 0
> item 85 key (FREE_SPACE UNTYPED 57714037227520) itemoff 12757 itemsize 41
> location key (74396 INODE_ITEM 0)
> cache generation 5542000 entries 0 bitmaps 0
> ... [snip] ...
>
Attachment:
signature.asc
Description: OpenPGP digital signature
