Re: xfs_repair segfaults

Ole Tange
2013-03-12T11:38:10Z

(Forgot CC-to list)

On Fri, Mar 8, 2013 at 11:21 AM, Ole Tange <tange@binf.ku.dk> wrote:
> On Mon, Mar 4, 2013 at 4:20 PM, Eric Sandeen <sandeen@sandeen.net> wrote:
>
>> 2) so you could run a "real" non-"n" xfs_repair on a metadata image as a more realistic dry run

So I made a new metadata image using xfs_metadump.sh from git:

./xfs_metadump.sh -o /dev/md123p1 franklin.xfs.metadump
pbzip2 franklin.xfs.metadump

Then I restored it:

pbzip2 -dc < franklin.xfs.noobfuscate.metadump.bz2 |
time ~/work/xfsprogs/mdrestore/xfs_mdrestore - franklin.img

Then I ran git version of xfs_repair (first with -n, then no option,
then with -L):

$ ~/work/xfsprogs/repair/xfs_repair -n franklin.img
# Load of output. Completes OK.

$ ~/work/xfsprogs/repair/xfs_repair franklin.img
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed. Mount the filesystem to replay the log, and unmount it before
re-running xfs_repair. If you are unable to mount the filesystem, then use
the -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.

$ ~/work/xfsprogs/repair/xfs_repair -L franklin.img
Phase 1 - find and verify superblock...
Phase 2 - using internal log
- zero log...
ALERT: The filesystem has valuable metadata changes in a log which is being
destroyed because the -L option was used.
- scan filesystem freespace and inode maps...
xfs_repair: scan.c:1080: scan_freelist: Assertion `0' failed.
Aborted (core dumped)

Then I restored the metadata:

pbzip2 -dc < franklin.xfs.noobfuscate.metadump.bz2 |
time ~/work/xfsprogs/mdrestore/xfs_mdrestore - franklin.img

Then I ran xfs_repair version 3.1.7. This gave a lot of output but
completed without core dumping.

The resulting filesystem was mountable and contained at least some of
the filenames I expected.

I believe either there is a new bug in the git version, or it simply
discovers a bug that 3.1.7 does not.

metadata, xfs_repair binary, core:
http://dna.ku.dk/~tange/xfs/

/Ole