XFS_REPAIR SEGFAULT

http://rzr.online.fr/q/segfault# Fixed #SegFault #BuG in latest #XfS #Xfs_Repair 3.1.7 but still fail to “mount: No such file or directory”

BUG : Segmentation fault

xfsprogs-3.1.7# ./repair/xfs_repair -v -L -P /dev/sda6 
(gdb) r -v -L -P /dev/sda6 
Starting program: /mnt/sdb6/local/home/rzr/xfsprogs-3.1.7/repair/xfs_repair -v -L -P /dev/sda6
[Thread debugging using libthread_db enabled]
Phase 1 - find and verify superblock...
Not enough RAM available for repair to enable prefetching.
This will be _slow_.
You need at least 237MB RAM to run with prefetching enabled.
        - block cache size set to 512 entries
Phase 2 - using internal log
        - zero log...
XFS: totally zeroed log
(...)
bad magic number 0xe483 on inode 1108554688, resetting magic number
bad version number 0x0 on inode 1108554688, resetting version number
bad inode format in inode 1108554688
cleared inode 1108554688
imap claims a free inode 1108554912 is in use, correcting imap and clearing inode
cleared inode 1108554912
correcting nblocks for inode 1108578720, was 1 - counted 0
correcting nextents for inode 1108578720, was 1 - counted 0
Segmentation fault

GDB

Joined #XfS on IrC , hch asked for a BackTrace :

gdb ./repair/xfs_repair # -v -L -P /dev/sda6 
(...)
correcting nblocks for inode 369846144, was 1 - counted 0
correcting nextents for inode 369846144, was 1 - counted 0

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4019b3c0 (LWP 25889)]
blkmap_get (blkmap=0x0, o=0) at bmap.c:117
117             for (i = 0; i < blkmap->nexts; i++, ext++) {
(gdb) p blkmap 
$1 = (blkmap_t *) 0x0
(gdb) bt
#0  blkmap_get (blkmap=0x0, o=0) at bmap.c:117
#1  0x000187fc in process_symlink (mp=0x0, lino=369846144, dino=Cannot access memory at address 0x2a0
) at dinode.c:1557
#2  0x0001a9a8 in process_dinode_int (mp=0x160b6780, dino=0x11fa600, agno=6, ino=41471, was_free=0, dirty=0xbeba832c, used=0xbeba8320, 
    verify_mode=1, uncertain=0, ino_discovery=1, check_dups=-1095072976, extra_attr_check=-1095072972, isa_dir=0x1, parent=0xbeba8320)
    at dinode.c:2799
#3  0x0001aba4 in process_dinode (mp=0x0, dino=0xa2c, agno=0, ino=0, was_free=0, dirty=0xbeba8330, used=0xbeba8334, ino_discovery=1, check_dups=0, 
    extra_attr_check=1, isa_dir=0xbeba832c, parent=0xbeba8320) at dinode.c:2898
#4  0x000107b4 in process_inode_chunk (mp=0xbeba8420, agno=2, num_inos=<value optimized out>, first_irec=0x0, ino_discovery=0, check_dups=0, 
    extra_attr_check=1, bogus=0x0) at dino_chunks.c:779
#5  0x00010fec in process_aginodes (mp=0xbeba8420, pf_args=0x0, agno=22, ino_discovery=1, check_dups=0, extra_attr_check=1) at dino_chunks.c:1018
#6  0x0002819c in process_ag_func (wq=0xbbe98, agno=22, arg=0x0) at phase3.c:154
#7  0x000288bc in phase3 (mp=0xbeba8420) at phase3.c:193
#8  0x0003db80 in main (argc=<value optimized out>, argv=<value optimized out>) at xfs_repair.c:753

PATCH

Been there Fixed it

diff -u ./repair/bmap.c~ ./repair/bmap.c
--- ./repair/bmap.c~    2011-10-21 22:46:09.000000000 +0000
+++ ./repair/bmap.c     2011-11-25 22:49:56.978587000 +0000
@@ -114,7 +114,8 @@
        bmap_ext_t      *ext = blkmap->exts;
        int             i;
 
-       for (i = 0; i < blkmap->nexts; i++, ext++) {
+
+       for (i = 0; (blkmap!=0 ) && i < blkmap->nexts; i++, ext++) {
                if (o >= ext->startoff && o < ext->startoff + ext->blockcount)
                        return ext->startblock + (o - ext->startoff);
        }

TEST

Tried again and it did not faced that null ptr …

./repair/xfs_repair -d -v  /dev/sda6  
Phase 6 - check inode connectivity...
reinitializing root directory
reinitializing realtime bitmap inode
reinitializing realtime summary inode
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - agno = 0
        - agno = 1
corrupt block 1 in directory inode 16777387: junking block
bad hash table for directory inode 16777387 (no data entry): rebuilding
rebuilding directory inode 16777387
bad hash table for directory inode 16777498 (no data entry): rebuilding
rebuilding directory inode 16777498
cache_node_purge: refcount was 1, not zero (node=0x2a4eee8)

fatal error -- couldn't map inode 16777507, err = 117

real    59m50.000s

NEXT

"cache_node_purge: refcount was 1, not zero"

http://oss.sgi.com/bugzilla/show_bug.cgi?id=757

"fatal error -- couldn't map inode $inode, err = 117"

http://permalink.gmane.org/gmane.comp.file-systems.xfs.general/30897

inode=16777481
part=/dev/sda6

xfs_db  -x -c "blockget inode $inode" $part
#| (...)
#| dir 101162125 block 0 entry /9 bad inode number -72057594037927937
#| (...)


xfsprogs-3.1.7# time PATH=./db:$PATH ./db/xfs_metadump.sh  /dev/sda6 ../rzr-host-nas/xfs_metadump.dat

Time for hope, or thinking about reformating again …

mount /dev/sda6 /mnt/sda6 || dmesg
#| mount: No such file or directory
#| XFS mounting filesystem sda6
#| XFS: failed to read root inode

MORE

@tag: SegFault NulL PtR

<iframe width="420" height="315" src="//www.youtube-nocookie.com/embed/H1GZydVTdnI" frameborder="0" allowfullscreen></iframe>

segfault.txt · Last modified: 2022/04/16 12:24 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki