diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index e6ed9e09c027..acd43f5ff5d6 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -2963,6 +2963,14 @@ xlog_valid_rec_header( __func__, be32_to_cpu(rhead->h_version)); return -EFSCORRUPTED; } + if (XFS_IS_CORRUPT(log->l_mp, xfs_has_logv2(log->l_mp) != + !!(be32_to_cpu(rhead->h_version) & XLOG_VERSION_2))) { + xfs_warn(log->l_mp, + "%s: xlog_rec_header h_version (%d) inconsistent with sb log version (%d)", + __func__, be32_to_cpu(rhead->h_version), + xfs_has_logv2(log->l_mp) ? 2 : 1); + return -EFSCORRUPTED; + } /* * LR body must have data (or it wouldn't have been written)