In certain cases, if a block is so messed up that crc, uuid and magic
number are all bad, we need to not only detect in phase3 but fix it
properly in phase6. In the current code, the mechanism doesn't work
in that it only pays attention to one of the parameters.
Note: in this case, the nlink inode link count drops to 1, but
re-running xfs_repair fixes it back to 2. This is a side effect that
should probably be handled in update_inode_nlinks() with separate patch.
Regardless, running xfs_repair twice, with this patch applied
fixes the issue. Recognize that this patch is a fix for xfs v5.
Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
v2: remove superfluous needmagic logic
v3: clarify the description
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
da_bno = (xfs_dablk_t)next_da_bno) {
const struct xfs_buf_ops *ops;
int error;
- struct xfs_dir2_data_hdr *d;
next_da_bno = da_bno + mp->m_dir_geo->fsbcount - 1;
if (bmap_next_offset(ip, &next_da_bno)) {
}
/* check v5 metadata */
- d = bp->b_addr;
- if (be32_to_cpu(d->magic) == XFS_DIR3_BLOCK_MAGIC ||
- be32_to_cpu(d->magic) == XFS_DIR3_DATA_MAGIC) {
+ if (xfs_has_crc(mp)) {
error = check_dir3_header(mp, bp, ino);
if (error) {
fixit++;