Bug 97481 - btrfs-progs: btrfs-calc-size outputs scary error messages for (apparently) good FS
Summary: btrfs-progs: btrfs-calc-size outputs scary error messages for (apparently) go...
Status: RESOLVED DOCUMENTED
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-28 19:57 UTC by Laurent Bonnaud
Modified: 2022-10-04 17:01 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.0
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Laurent Bonnaud 2015-04-28 19:57:54 UTC
Hi,

my root FS seems to be correct according to "btrfs scrub":

# btrfs scrub status /
scrub status for 347d095b-3b19-412b-841e-acfd162e2c53
        scrub started at Tue Apr 28 07:37:08 2015 and finished after 206 seconds
        total bytes scrubbed: 83.33GiB with 0 errors

However btrfs-calc-size (version 4.0rc1) complains about wrong checksums (see complete output below).

So either
 - there is something wrong with the FS and "btrfs scrub" should detect it
 - the FS is fine and btrfs-calc-size needs to be fixed

# ./btrfs-calc-size /dev/sda1 
Calculating size of root tree
        Total size: 64.00KiB
                Inline data: 0.00B
        Total seeks: 0
                Forward seeks: 0
                Backward seeks: 0
                Avg seek len: 0.00B
        Total clusters: 1
                Avg cluster size: 0.00B
                Min cluster size: 0.00B
                Max cluster size: 16.00KiB
        Total disk spread: 48.00KiB
        Total read time: 0 s 1 us
        Levels: 2
Calculating size of extent tree
        Total size: 42.00MiB
                Inline data: 0.00B
        Total seeks: 2363
                Forward seeks: 1285
                Backward seeks: 1078
                Avg seek len: 235.05MiB
        Seek histogram
                     16384 -    4898816:        354 ###
                   5046272 -   42516480:        354 ###
                  42663936 -  119013376:        354 ###
                 119488512 -  239468544:        354 ###
                 240222208 -  443465728:        354 ###
                 443744256 -  639795200:        354 ###
                 641957888 - 1024163840:        232 #
        Total clusters: 218
                Avg cluster size: 39.49KiB
                Min cluster size: 32.00KiB
                Max cluster size: 128.00KiB
        Total disk spread: 1018.34MiB
        Total read time: 0 s 2280 us
        Levels: 3
Calculating size of csum tree
        Total size: 47.86MiB
                Inline data: 0.00B
        Total seeks: 2132
                Forward seeks: 1298
                Backward seeks: 834
                Avg seek len: 218.43MiB
        Seek histogram
                     16384 -      32768:        347 ###
                     65536 -    9732096:        318 ###
                  10010624 -  100089856:        318 ###
                 101449728 -  229392384:        318 ###
                 229769216 -  463667200:        318 ###
                 464928768 -  767164416:        318 ###
                 770883584 - 1057882112:        127 #
        Total clusters: 296
                Avg cluster size: 65.13KiB
                Min cluster size: 32.00KiB
                Max cluster size: 384.00KiB
        Total disk spread: 1018.17MiB
        Total read time: 0 s 64283 us
        Levels: 3
Calculatin' size of fs tree
checksum verify failed on 787367510016 found E4E3BDB6 wanted 00000000
checksum verify failed on 787367510016 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787367510016, have=0
Failed to read blocknr 787367510016
checksum verify failed on 787372081152 found E4E3BDB6 wanted 00000000
checksum verify failed on 787372081152 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787372081152, have=0
Failed to read blocknr 787372081152
checksum verify failed on 787364839424 found E4E3BDB6 wanted 00000000
checksum verify failed on 787364839424 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787364839424, have=0
Failed to read blocknr 787364839424
checksum verify failed on 787374915584 found E4E3BDB6 wanted 00000000
checksum verify failed on 787374915584 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787374915584, have=0
Failed to read blocknr 787374915584
checksum verify failed on 787371163648 found E4E3BDB6 wanted 00000000
checksum verify failed on 787371163648 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787371163648, have=0
Failed to read blocknr 787371163648
checksum verify failed on 787374800896 found E4E3BDB6 wanted 00000000
checksum verify failed on 787374800896 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787374800896, have=0
Failed to read blocknr 787374800896
checksum verify failed on 787367133184 found E4E3BDB6 wanted 00000000
checksum verify failed on 787367133184 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=787367133184, have=0
Failed to read blocknr 787367133184
        Total size: 328.05MiB
                Inline data: 63.45MiB
        Total seeks: 15948
                Forward seeks: 9824
                Backward seeks: 6124
                Avg seek len: 168.38MiB
        Seek histogram
                     16384 -      49152:       2975 ###
                     81920 -    1228800:       2392 ###
                   1261568 -   50364416:       2391 ###
                  50429952 -  204767232:       2392 ###
                 205111296 -  387923968:       2391 ###
                 388284416 -  769277952:       2391 ###
                 769523712 - 1073512448:        604 |
        Total clusters: 2336
                Avg cluster size: 50.27KiB
                Min cluster size: 32.00KiB
                Max cluster size: 672.00KiB
        Total disk spread: 1023.95MiB
        Total read time: 24 s 240516 us
        Levels: 3
Comment 1 Laurent Bonnaud 2016-12-08 08:28:44 UTC
Hi,

I tried again with this Ubuntu package:

Package: btrfs-progs
Version: 4.7.3-1

and I am still getting the scary error messages:

# btrfs-calc-size /dev/sda1 
WARNING: /dev/sda1 already mounted, results may be inaccurate
checksum verify failed on 5168133095424 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168133095424 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168133095424, have=0
Calculating size of root tree
        Total size: 96.00KiB
                Inline data: 0.00B
        Total seeks: 5
                Forward seeks: 4
                Backward seeks: 1
                Avg seek len: 838.40KiB
        Total clusters: 1
                Avg cluster size: 0.00B
                Min cluster size: 0.00B
                Max cluster size: 16.00KiB
        Total disk spread: 2.03MiB
        Total read time: 0 s 3 us
        Levels: 2
Calculating size of extent tree
checksum verify failed on 5168133095424 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168133095424 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168133095424, have=0
Failed to read blocknr 5168133095424                                                                                             
checksum verify failed on 5168159752192 found E4E3BDB6 wanted 00000000                                                           
checksum verify failed on 5168159752192 found E4E3BDB6 wanted 00000000                                                           
bytenr mismatch, want=5168159752192, have=0                                                                                      
Failed to read blocknr 5168159752192                                                                                             
checksum verify failed on 5168162062336 found E4E3BDB6 wanted 00000000                                                           
checksum verify failed on 5168162062336 found E4E3BDB6 wanted 00000000                                                           
bytenr mismatch, want=5168162062336, have=0                                                                                      
Failed to read blocknr 5168162062336                                                                                             
checksum verify failed on 5168162111488 found E4E3BDB6 wanted 00000000                                                           
checksum verify failed on 5168162111488 found E4E3BDB6 wanted 00000000                                                           
bytenr mismatch, want=5168162111488, have=0                                                                                      
Failed to read blocknr 5168162111488                                                                                             
        Total size: 33.39MiB                                                                                                     
                Inline data: 0.00B                                                                                               
        Total seeks: 1743                                                                                                        
                Forward seeks: 915                                                                                               
                Backward seeks: 828                                                                                              
                Avg seek len: 217.49GiB                                                                                          
        Seek histogram                                                                                                           
                       16384 -     17678336:          261 ###                                                                    
                    17874944 -     97009664:          261 ###                                                                    
                    97091584 -    174931968:          261 ###                                                                    
                   175194112 -    307134464:          261 ###                                                                    
                   307855360 - 921980583936:          261 ###                                                                    
                922023198720 - 922560118784:          261 ###                                                                    
                922566983680 - 923170127872:          171 #                                                                      
        Total clusters: 257                                                                                                      
                Avg cluster size: 40.34KiB                                                                                       
                Min cluster size: 32.00KiB                                                                                       
                Max cluster size: 144.00KiB                                                                                      
        Total disk spread: 859.82GiB                                                                                             
        Total read time: 0 s 13871 us                                                                                            
        Levels: 3                                                                                                                
Calculating size of csum tree                                                                                                    
checksum verify failed on 4245031862272 found E4E3BDB6 wanted 00000000                                                           
checksum verify failed on 4245031862272 found E4E3BDB6 wanted 00000000                                                           
bytenr mismatch, want=4245031862272, have=0
Failed to read blocknr 4245031862272
checksum verify failed on 5168159784960 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168159784960 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168159784960, have=0
Failed to read blocknr 5168159784960
checksum verify failed on 5168161865728 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161865728 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161865728, have=0
Failed to read blocknr 5168161865728
        Total size: 58.28MiB
                Inline data: 0.00B
        Total seeks: 2773
                Forward seeks: 1584
                Backward seeks: 1189
                Avg seek len: 20.28GiB
        Seek histogram
                       16384 -        32768:          440 ###
                       65536 -      1294336:          415 ###
                     1327104 -     44220416:          414 ###
                    45432832 -    186056704:          414 ###
                   186761216 -    335511552:          414 ###
                   336101376 -    686473216:          414 ###
                   687095808 - 923126956032:          140 #
        Total clusters: 414
                Avg cluster size: 51.67KiB
                Min cluster size: 32.00KiB
                Max cluster size: 320.00KiB
        Total disk spread: 859.82GiB
        Total read time: 0 s 15297 us
        Levels: 3
Calculating size of fs tree
checksum verify failed on 5168161685504 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161685504 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161685504, have=0
Failed to read blocknr 5168161685504
checksum verify failed on 5168153264128 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168153264128 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168153264128, have=0
Failed to read blocknr 5168153264128
checksum verify failed on 5167676243968 found E4E3BDB6 wanted 00000000
checksum verify failed on 5167676243968 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5167676243968, have=0
Failed to read blocknr 5167676243968
checksum verify failed on 5168159260672 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168159260672 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168159260672, have=0
Failed to read blocknr 5168159260672
checksum verify failed on 5168161816576 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161816576 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161816576, have=0
Failed to read blocknr 5168161816576
checksum verify failed on 5167805464576 found E4E3BDB6 wanted 00000000
checksum verify failed on 5167805464576 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5167805464576, have=0
Failed to read blocknr 5167805464576
checksum verify failed on 5168161980416 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161980416 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161980416, have=0
Failed to read blocknr 5168161980416
checksum verify failed on 5168161914880 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161914880 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161914880, have=0
Failed to read blocknr 5168161914880
checksum verify failed on 5168161783808 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161783808 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161783808, have=0
Failed to read blocknr 5168161783808
checksum verify failed on 5168145170432 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168145170432 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168145170432, have=0
Failed to read blocknr 5168145170432
checksum verify failed on 5168161652736 found E4E3BDB6 wanted 00000000
checksum verify failed on 5168161652736 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=5168161652736, have=0
Failed to read blocknr 5168161652736
        Total size: 380.45MiB
                Inline data: 51.79MiB
        Total seeks: 16745
                Forward seeks: 9957
                Backward seeks: 6788
                Avg seek len: 206.96GiB
        Seek histogram
                       16384 -        49152:         2823 ###
                       81920 -       458752:         2519 ###
                      491520 -      9830400:         2511 ###
                     9879552 -    222855168:         2512 ###
                   223772672 - 921862389760:         2511 ###
                921862602752 - 922650656768:         2511 ###
                922650820608 - 923189313536:          867 #
        Total clusters: 2826
                Avg cluster size: 58.46KiB
                Min cluster size: 32.00KiB
                Max cluster size: 2.70MiB
        Total disk spread: 859.82GiB
        Total read time: 6 s 204903 us
        Levels: 3
Comment 2 David Sterba 2022-10-04 08:37:48 UTC
Running tree-stats on mounted filesystem may lead to the reports but it's only because the tool is not synchronized with kernel changes and could end up in stale blocks. The filesystem is fine.
Comment 3 Laurent Bonnaud 2022-10-04 10:12:07 UTC
Thanks for the clarification!

Perhaps btrfs-calc-size could display a warning message when it is run on a mounted filesystem?
Comment 4 David Sterba 2022-10-04 13:12:08 UTC
So the standalone tool has been moved from btrfs-calc-size to 'btrfs inspect-internal tree-stats' and it does print the warning:

# btrfs inspect tree-stats /dev/sdx
WARNING: /dev/sdx already mounted, results may be inaccurate
Calculating size of root tree
        Total size: 48.00KiB
                Inline data: 0.00B
        Total seeks: 2
...
Comment 5 Laurent Bonnaud 2022-10-04 13:31:40 UTC
Thanks for the hint!

Time for another bug report :>.

# btrfs inspect-internal tree-stats /dev/nvme0n1p2
WARNING: /dev/nvme0n1p2 already mounted, results may be inaccurate
Calculating size of root tree
        Total size: 144.00KiB
                Inline data: 0.00B
        Total seeks: 6
                Forward seeks: 5
                Backward seeks: 1
                Avg seek len: 228.75MiB
        Total clusters: 1
                Avg cluster size: 48.00KiB
                Min cluster size: 48.00KiB
                Max cluster size: 48.00KiB
        Total disk spread: 725.61MiB
        Total read time: 0 s 12 us
        Levels: 2
        Total nodes: 9
                On level 0:        8
                On level 1:        1  (avg fanout 8)
Calculating size of extent tree
Segmentation fault (core dumped)
Comment 6 David Sterba 2022-10-04 13:40:22 UTC
Can you please open an issue at https://github.com/kdave/btrfs-progs ? Thanks.
Comment 7 Laurent Bonnaud 2022-10-04 17:01:30 UTC
Done: https://github.com/kdave/btrfs-progs/issues/520

Thanks again!

Note You need to log in before you can comment on or make changes to this bug.