Re: interest in post-mortem examination of a BTRFS system and improving the btrfs-code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





2019-04-06 09:45, Qu Wenruo:


On 2019/4/6 下午3:16, Nik. wrote:


2019-04-06 02:03, Qu Wenruo:


On 2019/4/6 上午3:38, Nik. wrote:


2019-04-05 10:15, Qu Wenruo:


On 2019/4/5 下午3:41, Nik. wrote:

Below is the stderr of both commands:

# btrfs inspect dump-tree -t chunk /dev/md0>DT-chunk.log
# btrfs inspect dump-tree -t extent /dev/md0>DT-extent.log
ERROR: leaf 1894009225216 slot 30 pointer invalid, offset 146038
size 37
leaf data limit 16283
ERROR: skip remaining slots

Since the output on stdout is pretty long even after gzip, I am
providing only the output of the first command as attachment. The
output
of the second command (25 MB after gzip -9) can be downloaded here:

https://cloud.avgustinov.eu/index.php/s/AgbwWyCrbYjenq8

Sorry, I should have use a more specific command to get a smaller
output.
But anyway, your output is good enough for me to craft the fix patch.

Here is the dirty fix branch:
https://github.com/adam900710/btrfs-progs/tree/dirty_fix_for_nik

Compile the btrfs-progs as usual.
Just a late hint, you can disable document/btrfs-convert to reduce the
dependency:
$ ./configure --disable-documentation --disable-convert

Then, inside btrfs-progs directory, call:
# ./btrfs-corrupt-block -X /dev/md0
incorrect offsets 15003 146075
Open ctree failed

Oh, I forgot it's in extent tree, which may need to be read out at mount
time.

Just a new flag can handle it.

The branch is updated, please check.

New output:
Successfully repair tree block at 1894009225216

# mount -t btrfs -o ro /dev/md0 /mnt/md0/
mount: /mnt/md0: wrong fs type, bad option, bad superblock on /dev/md0,
missing codepage or helper program, or other error.

# dmesg|tail
...
[34848.784117] BTRFS info (device md0): disk space caching is enabled
[34848.954741] BTRFS info (device md0): bdev /dev/md0 errs: wr 0, rd 0,
flush 0, corrupt 2181, gen 0
[34850.150789] BTRFS critical (device md0): corrupt leaf: root=1
block=1894009225216 slot=30, unexpected item end, have 131072 expect 15003
[34850.151209] BTRFS error (device md0): failed to read block groups: -5
[34850.196156] BTRFS error (device md0): open_ctree failed

It seems that there is improvement...

Debug info added.

Please try again, and sorry for the inconvenience. Hopes this is the
last try.

#sudo ./btrfs-corrupt-block -X /dev/md0
old offset=131072 len=0
new offset=0 len=0
Successfully repair tree block at 1894009225216
# mount -t btrfs -o ro /dev/md0 /mnt/md0/
mount: /mnt/md0: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.
root@bach:~# dmesg|tail
...
[39342.860715] BTRFS info (device md0): disk space caching is enabled
[39342.933380] BTRFS info (device md0): bdev /dev/md0 errs: wr 0, rd 0, flush 0, corrupt 2181, gen 0 [39344.197411] BTRFS critical (device md0): corrupt leaf: root=1 block=1894009225216 slot=30, unexpected item end, have 0 expect 15003
[39344.197915] BTRFS error (device md0): failed to read block groups: -5
[39344.248137] BTRFS error (device md0): open_ctree failed

Sorry, I forgot to tell: this and previous attempt were with kernel 4.15.0-47-generic. My Ubuntu 18.04 LTS is having enormous problems with Kernel 5.0.2 - very long boot; network, login and other services cycling trough "start, timeout, fail, stop" again and again, etc. If kernel 5 is important I will need time to get it right (maybe even assistance from another(?) developer group). Actually with 5.0.2 each boot sends me an email about an empty and not automatically mounted btrfs filesystem with raid1 profile, consisting from two devices (sdb and sdi):

kernel: [ 9.625619] BTRFS: device fsid 05bd214a-8961-4165-9205-a5089a65b59b devid 2 transid 832 /dev/sdi

Scrubbing it finishes almost immediately (see below), but during next boot the email comes again:

#btrfs scrub status /mnt/b
scrub status for 05bd214a-8961-4165-9205-a5089a65b59b
scrub started at Sat Apr 6 10:42:15 2019 and finished after 00:00:00
        total bytes scrubbed: 1.51MiB with 0 errors

Should I be worried about it?

Kind regards,
Nik.
--

Thanks,
Qu

Thank you.
Nik.
--

Thanks,
Qu


Actually there was one warning during make, I don't know of it is
relevant:
      [CC]     check/main.o
check/main.c: In function ‘try_repair_inode’:
check/main.c:2688:5: warning: ‘ret’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
    if (!ret) {
       ^
check/main.c:2666:6: note: ‘ret’ was declared here
    int ret;
        ^~~

The previous steps were as follow (output ommited, since nothing
unexpected happened):
#git clone --single-branch -v -b dirty_fix_for_nik
https://github.com/adam900710/btrfs-progs.git
#cd btrfs-progs/
#./autogen.sh
#./configure --disable-documentation --disable-convert
#make

Did I got the right branch? Or miss any step?

Kind regards,
Nik.
--

If everything goes correctly, it should output something like:
     Successfully repaired tree block at 1894009225216
(And please ignore any grammar error in my code)

After that, please run a "btrfs check --readonly" to ensure no other
bit
flip in your fs.

Thanks,
Qu




Hope this is ok.

Regards,
Nik.
-






[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux