Bug#470706: xfsprogs: xfs_repair crashes during attempted repair

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

 



Dear Maintainer,
I tried to find out where this given backtrace points to.

I think that following would be the location
where the invalid pointer was tried to be freed.

Attached file contains some details on how it was retrieved.

Upstream removed/replaced function teardown_ag_bmap in [1],
therefore this bug might be just closed.

Kind regards,
Bernhard



Phase 5 - rebuild AG headers and trees...
*** glibc detected *** xfs_repair: munmap_chunk(): invalid pointer: 0xb092c008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6(cfree+0x1bb)[0xb7de24ab]            | 0xb7de24ab | 
xfs_repair[0x8061f2d]                                        | 0x08061f2d | <teardown_ag_bmap+21>:   call   <free@plt>
xfs_repair[0x806b311]                                        | 0x0806b311 | <phase5+60>:             call   <teardown_ag_bmap>
xfs_repair[0x807cb28]                                        | 0x0807cb28 | <main+884>:              call   <phase5>
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7d89450] | 0xb7d89450 | <__libc_start_main+226>: call   *0x8(%ebp)
xfs_repair[0x8049541]                                        | 0x08049541 | <_start+28>:             call   <__libc_start_main@plt>
======= Memory map: ========



[1] https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/repair?id=c1f7a46c4d6403e3313c13487e2f2174f92db670


Phase 5 - rebuild AG headers and trees...
*** glibc detected *** xfs_repair: munmap_chunk(): invalid pointer:
0xb092c008 ***
======= Backtrace: =========
/lib/i686/cmov/libc.so.6(cfree+0x1bb)[0xb7de24ab]            | 0xb7de24ab | 
xfs_repair[0x8061f2d]                                        | 0x08061f2d | <teardown_ag_bmap+21>:   call   0x80492c4 <free@plt>
xfs_repair[0x806b311]                                        | 0x0806b311 | <phase5+60>:             call   0x8061d60 <teardown_ag_bmap>
xfs_repair[0x807cb28]                                        | 0x0807cb28 | <main+884>:              call   0x806ae60 <phase5>
/lib/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7d89450] | 0xb7d89450 | <__libc_start_main+226>: call   *0x8(%ebp)
xfs_repair[0x8049541]                                        | 0x08049541 | <_start+28>:             call   0x8049254 <__libc_start_main@plt>
======= Memory map: ========
08048000-080ce000 r-xp 00000000 03:01 195863     /sbin/xfs_repair
080ce000-080cf000 rw-p 00085000 03:01 195863     /sbin/xfs_repair
080cf000-0aadc000 rw-p 080cf000 00:00 0          [heap]




##########



deb     [check-valid-until=no] http://snapshot.debian.org/archive/debian/20091004T111800Z/ lenny main
deb-src [check-valid-until=no] http://snapshot.debian.org/archive/debian/20091004T111800Z/ lenny main

apt-get update
apt-get install debian-archive-keyring gdb xfsprogs devscripts dpkg-dev build-essential uuid-dev autoconf debhelper gettext libtool libreadline5-dev gcc-4.1


wget http://snapshot.debian.org/archive/debian/20060822T000000Z/pool/main/x/xfsprogs/xfsprogs_2.8.11-1_i386.deb
dpkg -i xfsprogs_2.8.11-1_i386.deb


https://buildd.debian.org/status/fetch.php?pkg=xfsprogs&arch=amd64&ver=2.8.11-1&stamp=1156139624&raw=0
# Unfortunately no log for i386
# -> was built with gcc-4.1


ln -sf gcc-4.1 /usr/bin/gcc



mkdir xfsprogs/orig -p
cd    xfsprogs/orig
dget http://snapshot.debian.org/archive/debian/20060822T000000Z/pool/main/x/xfsprogs/xfsprogs_2.8.11-1.dsc
dpkg-source -x xfsprogs_2.8.11-1.dsc
cd ../..



cd xfsprogs
cp orig try1 -a
cd try1/xfsprogs-2.8.11/
dpkg-buildpackage -b





benutzer@debian:~$ objdump -D /sbin/xfs_repair > objdump.txt




debian:~/xfsprogs/try1/xfsprogs-2.8.11# file /sbin/xfs_repair /root/xfsprogs/try1/xfsprogs-2.8.11/repair/xfs_repair
/sbin/xfs_repair:                                      ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), for GNU/Linux 2.4.1, stripped
/root/xfsprogs/try1/xfsprogs-2.8.11/repair/xfs_repair: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped




debian:~/xfsprogs/try1/xfsprogs-2.8.11# gdb -q --args /root/xfsprogs/try1/xfsprogs-2.8.11/repair/xfs_repair
(gdb) set width 0
(gdb) set pagination off
(gdb) disassemble main




debian:~# gdb -q --args /sbin/xfs_repair 
(no debugging symbols found)
(gdb) set width 0
(gdb) set pagination off
(gdb) b __libc_start_main
















           --- original binary ---                                              |              --- rebuild with debug info ---
                                                                                | 
(gdb) info target                                                               | (gdb) info target
Symbols from "/sbin/xfs_repair".                                                | Symbols from "/root/xfsprogs/try1/xfsprogs-2.8.11/repair/xfs_repair".
Local exec file:                                                                | Local exec file:
        `/sbin/xfs_repair', file type elf32-i386.                               |         `/root/xfsprogs/try1/xfsprogs-2.8.11/repair/xfs_repair', file type elf32-i386.
        Entry point: 0x8049520  0x08048134 - 0x08048147 is .interp              |         Entry point: 0x8049590  0x08048134 - 0x08048147 is .interp
        ...                                                                     |         ...
        0x08049520 - 0x080c1434 is .text                                        |         0x08049590 - 0x080bb4dc is .text
                                                                                |
                                                                                |
(gdb) disassemble 0x8049520 0x8049520+35                                        | (gdb) disassemble _start
Dump of assembler code from 0x8049520 to 0x8049543:                             | Dump of assembler code for function _start:
0x08049520 <strcpy@plt+28>:     xor    %ebp,%ebp                                | 0x08049590 <_start+0>:  xor    %ebp,%ebp
0x08049522 <strcpy@plt+30>:     pop    %esi                                     | 0x08049592 <_start+2>:  pop    %esi
0x08049523 <strcpy@plt+31>:     mov    %esp,%ecx                                | 0x08049593 <_start+3>:  mov    %esp,%ecx
0x08049525 <strcpy@plt+33>:     and    $0xfffffff0,%esp                         | 0x08049595 <_start+5>:  and    $0xfffffff0,%esp
0x08049528 <strcpy@plt+36>:     push   %eax                                     | 0x08049598 <_start+8>:  push   %eax
0x08049529 <strcpy@plt+37>:     push   %esp                                     | 0x08049599 <_start+9>:  push   %esp
0x0804952a <strcpy@plt+38>:     push   %edx                                     | 0x0804959a <_start+10>: push   %edx
0x0804952b <strcpy@plt+39>:     push   $0x80c1350                               | 0x0804959b <_start+11>: push   $0x80bb440
0x08049530 <strcpy@plt+44>:     push   $0x80c13a0                               | 0x080495a0 <_start+16>: push   $0x80bb450
0x08049535 <strcpy@plt+49>:     push   %ecx                                     | 0x080495a5 <_start+21>: push   %ecx
0x08049536 <strcpy@plt+50>:     push   %esi                                     | 0x080495a6 <_start+22>: push   %esi
0x08049537 <strcpy@plt+51>:     push   $0x807c7a0                               | 0x080495a7 <_start+23>: push   $0x8079ec0
0x0804953c <strcpy@plt+56>:     call   0x8049374 <__libc_start_main@plt>        | 0x080495ac <_start+28>: call   0x8049254 <__libc_start_main@plt>
0x08049541 <strcpy@plt+61>:     hlt                                             | 0x080495b1 <_start+33>: hlt    
0x08049542 <strcpy@plt+62>:     nop                                             |
End of assembler dump.                                                          |
                                                                                |
                                                                                | (gdb) print main
                                                                                |  $2 = {int (int, char **)} 0x8079ec0 <main>
                                                                                | 
--> main starts at 0x807c7a0                                                    | 
                                                                                | 
                                                                                | 
(gdb) disassemble 0x807c7a0 0x807c7a0+1650                                      | (gdb) disassemble 0x08079ec0 0x08079ec0+1640 
Dump of assembler code from 0x807c7a0 to 0x807ce12:                             | Dump of assembler code from 0x8079ec0 to 0x807a528:
0x0807c7a0 <strcpy@plt+209564>: lea    0x4(%esp),%ecx                           | 0x08079ec0 <main+0>:    lea    0x4(%esp),%ecx
0x0807c7a4 <strcpy@plt+209568>: and    $0xfffffff0,%esp                         | 0x08079ec4 <main+4>:    and    $0xfffffff0,%esp
...
0x0807cadd <strcpy@plt+210393>: call   0x807be50 <strcpy@plt+207180>            | 0x0807c68f <main+831>:  call   0x807b9e0 <do_warn>
0x0807cae2 <strcpy@plt+210398>: lea    0x0(%esi,%eiz,1),%esi                    | 0x0807c694 <main+836>:  mov    0x80ce9c4,%edi
0x0807cae9 <strcpy@plt+210405>: lea    0x0(%edi,%eiz,1),%edi                    | 0x0807c69a <main+842>:  test   %edi,%edi
0x0807caf0 <strcpy@plt+210412>: mov    0x80ced48,%eax                           | 0x0807c69c <main+844>:  je     0x807c5d3 <main+643>
0x0807caf5 <strcpy@plt+210417>: test   %eax,%eax                                | 0x0807c6a2 <main+850>:  mov    0x80ce9a4,%esi
0x0807caf7 <strcpy@plt+210419>: je     0x807ca20 <strcpy@plt+210204>            | 0x0807c6a8 <main+856>:  test   %esi,%esi
0x0807cafd <strcpy@plt+210425>: mov    0x80cedfc,%eax                           | 0x0807c6aa <main+858>:  jne    0x807c8a5 <main+1365>
0x0807cb02 <strcpy@plt+210430>: test   %eax,%eax                                | 0x0807c6b0 <main+864>:  movl   $0x80cb7f8,(%esp)
0x0807cb04 <strcpy@plt+210432>: jne    0x807cd09 <strcpy@plt+210949>            | 
0x0807cb0a <strcpy@plt+210438>: movl   $0x80cbc98,(%esp)                        | 
0x0807cb11 <strcpy@plt+210445>: call   0x807be50 <strcpy@plt+207180>            | 0x0807c6b7 <main+871>:  call   0x807b9e0 <do_warn>
0x0807cb16 <strcpy@plt+210450>: jmp    0x807ca20 <strcpy@plt+210204>            | 0x0807c6bc <main+876>:  jmp    0x807c5d3 <main+643>
0x0807cb1b <strcpy@plt+210455>: nop                                             | 0x0807c6c1 <main+881>:  mov    %ebx,(%esp)
0x0807cb1c <strcpy@plt+210456>: lea    0x0(%esi,%eiz,1),%esi                    | 
0x0807cb20 <strcpy@plt+210460>: mov    %ebx,(%esp)                              | 
                                                                                | 
0x0807cb23 <strcpy@plt+210463>: call   0x806b2d0 <strcpy@plt+138700>            | 0x0807c6c4 <main+884>:  call   0x806ae60 <phase5>
0x0807cb28 <strcpy@plt+210468>: jmp    0x807c9bb <strcpy@plt+210103>            | 0x0807c6c9 <main+889>:  jmp    0x807c573 <main+547>
                                                                                | 
0x0807cb2d <strcpy@plt+210473>: lea    0x0(%esi),%esi                           | 0x0807c6ce <main+894>:  xchg   %ax,%ax
0x0807cb30 <strcpy@plt+210476>: xor    %esi,%esi                                | 
0x0807cb32 <strcpy@plt+210478>: call   0x807f390 <strcpy@plt+220812>            | 0x0807c6d0 <main+896>:  call   0x807ee60 <libxfs_icache_purge>
0x0807cb37 <strcpy@plt+210483>: call   0x807f3b0 <strcpy@plt+220844>            | 0x0807c6d5 <main+901>:  call   0x807ee80 <libxfs_bcache_purge>
0x0807cb3c <strcpy@plt+210488>: mov    %esi,0x4(%esp)                           | 0x0807c6da <main+906>:  movl   $0x0,0x4(%esp)
0x0807cb40 <strcpy@plt+210492>: mov    %ebx,(%esp)                              | 0x0807c6e2 <main+914>:  mov    %ebx,(%esp)
0x0807cb43 <strcpy@plt+210495>: call   0x807fca0 <strcpy@plt+223132>            | 0x0807c6e5 <main+917>:  call   0x807f750 <libxfs_getsb>
0x0807cb48 <strcpy@plt+210500>: test   %eax,%eax                                | 0x0807c6ea <main+922>:  test   %eax,%eax
0x0807cb4a <strcpy@plt+210502>: mov    %eax,%edi                                | 0x0807c6ec <main+924>:  mov    %eax,%edi
0x0807cb4c <strcpy@plt+210504>: je     0x807cd4d <strcpy@plt+211017>            | 0x0807c6ee <main+926>:  je     0x807c8e9 <main+1433>
0x0807cb52 <strcpy@plt+210510>: mov    0x48(%edi),%esi                          | 0x0807c6f4 <main+932>:  mov    0x48(%edi),%esi
0x0807cb55 <strcpy@plt+210513>: movzwl 0xb0(%esi),%eax                          | 0x0807c6f7 <main+935>:  movzwl 0xb0(%esi),%eax
0x0807cb5c <strcpy@plt+210520>: test   $0x24,%al                                | 0x0807c6fe <main+942>:  test   $0x24,%al
0x0807cb5e <strcpy@plt+210522>: jne    0x807cc66 <strcpy@plt+210786>            | 0x0807c700 <main+944>:  jne    0x807c80a <main+1210>
0x0807cb64 <strcpy@plt+210528>: mov    0x80cee2c,%ecx                           | 0x0807c706 <main+950>:  mov    0x80ce988,%eax
0x0807cb6a <strcpy@plt+210534>: test   %ecx,%ecx                                | 0x0807c70b <main+955>:  test   %eax,%eax
0x0807cb6c <strcpy@plt+210536>: jne    0x807cc31 <strcpy@plt+210733>            | 0x0807c70d <main+957>:  jne    0x807c7d1 <main+1153>
0x0807cb72 <strcpy@plt+210542>: xor    %eax,%eax                                | 0x0807c713 <main+963>:  movl   $0x0,0x4(%esp)
0x0807cb74 <strcpy@plt+210544>: mov    %eax,0x4(%esp)                           | 0x0807c71b <main+971>:  mov    %edi,(%esp)
0x0807cb78 <strcpy@plt+210548>: mov    %edi,(%esp)                              | 0x0807c71e <main+974>:  call   0x807eec0 <libxfs_writebuf>
                                                                                |
                                                                                |
                                                                                |
                                                                                |
                                                                                |
                                                                                |
                                                                                |
(gdb) disassemble 0x806b2d0 0x806b2d0+800                                       | (gdb) disassemble phase5
Dump of assembler code from 0x806b2d0 to 0x806b5f0:                             | Dump of assembler code for function phase5:
0x0806b2d0 <strcpy@plt+138700>: push   %ebp                                     | 0x0806ae60 <phase5+0>:   push   %ebp
0x0806b2d1 <strcpy@plt+138701>: mov    %esp,%ebp                                | 0x0806ae61 <phase5+1>:   mov    %esp,%ebp
0x0806b2d3 <strcpy@plt+138703>: push   %edi                                     | 0x0806ae63 <phase5+3>:   push   %edi
0x0806b2d4 <strcpy@plt+138704>: push   %esi                                     | 0x0806ae64 <phase5+4>:   push   %esi
0x0806b2d5 <strcpy@plt+138705>: push   %ebx                                     | 0x0806ae65 <phase5+5>:   push   %ebx
0x0806b2d6 <strcpy@plt+138706>: sub    $0x39c,%esp                              | 0x0806ae66 <phase5+6>:   sub    $0x39c,%esp
0x0806b2dc <strcpy@plt+138712>: mov    0x8(%ebp),%edi                           | 0x0806ae6c <phase5+12>:  mov    0x8(%ebp),%edi
0x0806b2df <strcpy@plt+138715>: movl   $0x80c7dc4,(%esp)                        | 0x0806ae6f <phase5+15>:  movl   $0x80c7924,(%esp)
0x0806b2e6 <strcpy@plt+138722>: call   0x807be20 <strcpy@plt+207132>            | 0x0806ae76 <phase5+22>:  call   0x807b9b0 <do_log>
0x0806b2eb <strcpy@plt+138727>: mov    %edi,(%esp)                              | 0x0806ae7b <phase5+27>:  mov    %edi,(%esp)
0x0806b2ee <strcpy@plt+138730>: call   0x8068bf0 <strcpy@plt+128748>            | 0x0806ae7e <phase5+30>:  call   0x8068960 <keep_fsinos>
0x0806b2f3 <strcpy@plt+138735>: mov    0x58(%edi),%ebx                          | 0x0806ae83 <phase5+35>:  mov    0x58(%edi),%edx
0x0806b2f6 <strcpy@plt+138738>: test   %ebx,%ebx                                | 0x0806ae86 <phase5+38>:  test   %edx,%edx
0x0806b2f8 <strcpy@plt+138740>: je     0x806b566 <strcpy@plt+139362>            | 0x0806ae88 <phase5+40>:  je     0x806b105 <phase5+677>
0x0806b2fe <strcpy@plt+138746>: xor    %esi,%esi                                | 0x0806ae8e <phase5+46>:  xor    %esi,%esi
0x0806b300 <strcpy@plt+138748>: jmp    0x806b525 <strcpy@plt+139297>            | 0x0806ae90 <phase5+48>:  jmp    0x806b0c0 <phase5+608>
0x0806b305 <strcpy@plt+138753>: mov    %esi,0x4(%esp)                           | 0x0806ae95 <phase5+53>:  mov    %esi,0x4(%esp)
0x0806b309 <strcpy@plt+138757>: mov    %edi,(%esp)                              | 0x0806ae99 <phase5+57>:  mov    %edi,(%esp)
                                                                                |
0x0806b30c <strcpy@plt+138760>: call   0x8061f10 <strcpy@plt+100876>            | 0x0806ae9c <phase5+60>:  call   0x8061d60 <teardown_ag_bmap>
0x0806b311 <strcpy@plt+138765>: lea    -0x28(%ebp),%eax                         | 0x0806aea1 <phase5+65>:  lea    -0x28(%ebp),%eax
                                                                                |
0x0806b314 <strcpy@plt+138768>: lea    -0x20(%ebp),%edx                         | 0x0806aea4 <phase5+68>:  lea    -0x20(%ebp),%edx
0x0806b317 <strcpy@plt+138771>: mov    %eax,0x10(%esp)                          | 0x0806aea7 <phase5+71>:  mov    %eax,0x10(%esp)
0x0806b31b <strcpy@plt+138775>: lea    -0x37c(%ebp),%eax                        | 0x0806aeab <phase5+75>:  lea    -0x37c(%ebp),%eax
0x0806b321 <strcpy@plt+138781>: mov    %edx,0xc(%esp)                           | 0x0806aeb1 <phase5+81>:  mov    %edx,0xc(%esp)
0x0806b325 <strcpy@plt+138785>: mov    %eax,0x8(%esp)                           | 0x0806aeb5 <phase5+85>:  mov    %eax,0x8(%esp)
0x0806b329 <strcpy@plt+138789>: mov    %esi,0x4(%esp)                           | 0x0806aeb9 <phase5+89>:  mov    %esi,0x4(%esp)
0x0806b32d <strcpy@plt+138793>: mov    %edi,(%esp)                              | 0x0806aebd <phase5+93>:  mov    %edi,(%esp)
0x0806b330 <strcpy@plt+138796>: call   0x806a8e0 <strcpy@plt+136156>            | 0x0806aec0 <phase5+96>:  call   0x806a4a0 <init_ino_cursor>
0x0806b335 <strcpy@plt+138801>: mov    -0x20(%ebp),%eax                         | 0x0806aec5 <phase5+101>: mov    -0x20(%ebp),%eax
0x0806b338 <strcpy@plt+138804>: add    %eax,0x80cee10                           | 0x0806aec8 <phase5+104>: add    %eax,0x80ce9b0
                                                                                |
                                                                                |
                                                                                |
                                                                                |
                                                                                |
(gdb) disassemble 0x8061f10 0x8061f10+50                                        | (gdb) disassemble teardown_ag_bmap
Dump of assembler code from 0x8061f10 to 0x8061f42:                             | Dump of assembler code for function teardown_ag_bmap:
0x08061f10 <strcpy@plt+100876>: push   %ebp                                     | 0x08061d60 <teardown_ag_bmap+0>:        push   %ebp
0x08061f11 <strcpy@plt+100877>: mov    %esp,%ebp                                | 0x08061d61 <teardown_ag_bmap+1>:        mov    %esp,%ebp
0x08061f13 <strcpy@plt+100879>: push   %ebx                                     | 0x08061d63 <teardown_ag_bmap+3>:        push   %ebx
0x08061f14 <strcpy@plt+100880>: sub    $0x4,%esp                                | 0x08061d64 <teardown_ag_bmap+4>:        sub    $0x4,%esp
0x08061f17 <strcpy@plt+100883>: mov    0xc(%ebp),%ebx                           | 0x08061d67 <teardown_ag_bmap+7>:        mov    0xc(%ebp),%ebx
0x08061f1a <strcpy@plt+100886>: mov    0x80cede4,%eax                           | 0x08061d6a <teardown_ag_bmap+10>:       mov    0x80ce908,%eax
0x08061f1f <strcpy@plt+100891>: shl    $0x2,%ebx                                | 0x08061d6f <teardown_ag_bmap+15>:       mov    (%eax,%ebx,4),%eax
0x08061f22 <strcpy@plt+100894>: mov    (%ebx,%eax,1),%eax                       | 0x08061d72 <teardown_ag_bmap+18>:       mov    %eax,(%esp)
0x08061f25 <strcpy@plt+100897>: mov    %eax,(%esp)                              | 0x08061d75 <teardown_ag_bmap+21>:       call   0x80492c4 <free@plt>
0x08061f28 <strcpy@plt+100900>: call   0x8049444 <free@plt>                     | 0x08061d7a <teardown_ag_bmap+26>:       mov    0x80ce908,%eax
0x08061f2d <strcpy@plt+100905>: mov    0x80cede4,%eax                           | 0x08061d7f <teardown_ag_bmap+31>:       movl   $0x0,(%eax,%ebx,4)
0x08061f32 <strcpy@plt+100910>: movl   $0x0,(%ebx,%eax,1)                       | 0x08061d86 <teardown_ag_bmap+38>:       add    $0x4,%esp
0x08061f39 <strcpy@plt+100917>: pop    %eax                                     | 0x08061d89 <teardown_ag_bmap+41>:       pop    %ebx
0x08061f3a <strcpy@plt+100918>: pop    %ebx                                     | 0x08061d8a <teardown_ag_bmap+42>:       pop    %ebp
0x08061f3b <strcpy@plt+100919>: pop    %ebp                                     | 0x08061d8b <teardown_ag_bmap+43>:       ret    
0x08061f3c <strcpy@plt+100920>: ret                                             | End of assembler dump.
End of assembler dump.                                                          | (gdb) 




(gdb) list teardown_ag_bmap
114
115     /* ARGSUSED */
116     void
117     teardown_ag_bmap(xfs_mount_t *mp, xfs_agnumber_t agno)
118     {
119             ASSERT(ba_bmap[agno] != NULL);
120
121             free(ba_bmap[agno]);
122             ba_bmap[agno] = NULL;
123
124             return;
125     }
# repair/incore.c



(gdb) list phase5
1414                    set_inode_used(irec, i);
1415    }
1416
1417    void
1418    phase5(xfs_mount_t *mp)
1419    {
1420            __uint64_t      num_inos;
1421            __uint64_t      num_free_inos;
1422            bt_status_t     bno_btree_curs;
1423            bt_status_t     bcnt_btree_curs;
1424            bt_status_t     ino_btree_curs;
1425            xfs_agnumber_t  agno;
1426            int             extra_blocks = 0;
1427            uint            num_freeblocks;
1428            xfs_extlen_t    freeblks1;
1429    #ifdef DEBUG
1430            xfs_extlen_t    freeblks2;
1431    #endif
1432            xfs_agblock_t   num_extents;
1433            extern int      count_bno_extents(xfs_agnumber_t);
1434            extern int      count_bno_extents_blocks(xfs_agnumber_t, uint *);
1435    #ifdef XR_BLD_FREE_TRACE
1436            extern int      count_bcnt_extents(xfs_agnumber_t);
1437    #endif
1438
1439            do_log(_("Phase 5 - rebuild AG headers and trees...\n"));
1440
1441    #ifdef XR_BLD_FREE_TRACE
1442            fprintf(stderr, "inobt level 1, maxrec = %d, minrec = %d\n",
1443                    XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_inobt, 0),
1444                    XFS_BTREE_BLOCK_MINRECS(mp->m_sb.sb_blocksize, xfs_inobt, 0)
1445                    );
1446            fprintf(stderr, "inobt level 0 (leaf), maxrec = %d, minrec = %d\n",
1447                    XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_inobt, 1),
1448                    XFS_BTREE_BLOCK_MINRECS(mp->m_sb.sb_blocksize, xfs_inobt, 1)
1449                    );
1450            fprintf(stderr, "xr inobt level 0 (leaf), maxrec = %d\n",
1451                    XR_INOBT_BLOCK_MAXRECS(mp, 0));
1452            fprintf(stderr, "xr inobt level 1 (int), maxrec = %d\n",
1453                    XR_INOBT_BLOCK_MAXRECS(mp, 1));
1454            fprintf(stderr, "bnobt level 1, maxrec = %d, minrec = %d\n",
1455                    XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_alloc, 0),
1456                    XFS_BTREE_BLOCK_MINRECS(mp->m_sb.sb_blocksize, xfs_alloc, 0));
1457            fprintf(stderr, "bnobt level 0 (leaf), maxrec = %d, minrec = %d\n",
1458                    XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_alloc, 1),
1459                    XFS_BTREE_BLOCK_MINRECS(mp->m_sb.sb_blocksize, xfs_alloc, 1));
1460    #endif
1461
1462            /*
1463             * make sure the root and realtime inodes show up allocated
1464             */
1465            keep_fsinos(mp);
1466
1467            for (agno = 0; agno < mp->m_sb.sb_agcount; agno++)  {
1468                    /*
1469                     * build up incore bno and bcnt extent btrees
1470                     */
1471                    num_extents = mk_incore_fstree(mp, agno);
1472
1473    #ifdef XR_BLD_FREE_TRACE
1474                    fprintf(stderr, "# of bno extents is %d\n",
1475                                    count_bno_extents(agno));
1476    #endif
1477
1478                    if (num_extents == 0)  {
1479                            /*
1480                             * XXX - what we probably should do here is pick an
1481                             * inode for a regular file in the allocation group
1482                             * that has space allocated and shoot it by traversing
1483                             * the bmap list and putting all its extents on the
1484                             * incore freespace trees, clearing the inode,
1485                             * and clearing the in-use bit in the incore inode
1486                             * tree.  Then try mk_incore_fstree() again.
1487                             */
1488                            do_error(_("unable to rebuild AG %u.  "
1489                                      "Not enough free space in on-disk AG.\n"),
1490                                    agno);
1491                    }
1492
1493                    /*
1494                     * done with the AG bitmap, toss it...
1495                     */
1496                    teardown_ag_bmap(mp, agno);
1497
# repair/phase5.c






[1] https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/repair?id=c1f7a46c4d6403e3313c13487e2f2174f92db670

[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux