]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_repair: fix get_agino_buf to avoid corrupting inodes
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Oct 2016 22:14:34 +0000 (15:14 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 26 Oct 2016 19:43:53 +0000 (12:43 -0700)
commit15028317fd914a62170372a08026a175784b985a
tree43e56a7ec17d193e4fa49611461995b4e83dd02f
parentc77896fc158daf47e9f4a7ee38a483807fc49818
xfs_repair: fix get_agino_buf to avoid corrupting inodes

The inode buffering code tries to read inodes in units of chunks,
which are the larger of 8K or 1 FSB.  Each chunk gets its own xfs_buf,
which means that get_agino_buf must calculate the disk address of the
chunk and feed that to libxfs_readbuf in order to find the inode data
correctly.  The current code simply grabs the chunk for the start
inode and indexes from that, which corrupts memory because the start
inode and the target inode could be in different inode chunks.  That
causes the assert in rmap.c to blow when we clear the reflink flag.

(Also fix some minor errors in the debugging printfs.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/rdwr.c
repair/dinode.c
repair/dinode.h