]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
repair: get rid of BADFSINO
authorDave Chinner <dchinner@redhat.com>
Tue, 8 Jul 2014 00:36:39 +0000 (10:36 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 8 Jul 2014 00:36:39 +0000 (10:36 +1000)
commit871fbfd5ce2bfdc8030371aa3b1517efc03d9455
treeb5cadde6a3f32da76bd395226151fa4dbb447dab
parentd085fb486f8b33304f2fdf704411313ffc8bcc0c
repair: get rid of BADFSINO

When we find a bad dirent, we "clear" the inode the inode number by
writing BADFSINO to the inode number in the entry:

#define BADFSINO        ((xfs_ino_t)0xfeffffffffffffffULL)

We then capture this bad inode number later in the same function
either in the same pass or in a later phase and junk the entry.
When we junk the entry, we write a "/" over the first character of
the dirent name, which is then detected up later by the directory
rebuild and ignored.

The issue with this is that the directory buffer can be written to
disk between the dirent being marked with BADFSINO and the directory
rebuild processing in phase 6, resulting in the directory block
verifier firing this error:

Invalid inode number 0xfeffffffffffffff
xfs_dir_ino_validate: XFS_ERROR_REPORT
Metadata corruption detected at block 0x11fbb698/0x1000
libxfs_writebufr: write verifer failed on bno 0x11fbb698/0x1000

And so will not write the *corrupt block* to disk. The result is
that we don't repair a corruption in the directory block correctly
and subsequent repair runs continue to find problems with the
directory.

We really don't need both BADFSINO *and* overwriting the dirent name
with "/" to mark an entry as junked. They both mean exactly the same
thing, so get rid of BADFSINO and only use the name junking to mark
dirents as bad. This prevents the directory data block verifier from
triggering on bad inode numbers, and so the later reread of the
block will find the junked entries correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/dir2.c