Commit 040c52c0 authored by Brian Foster's avatar Brian Foster Committed by Dave Chinner

xfs: don't warn on buffers not being recovered due to LSN

The log recovery buffer validation function is invoked in cases where a
buffer update may be skipped due to LSN ordering. If the validation
function happens to come across directory conversion situations (e.g., a
dir3 block to data conversion), it may warn about seeing a buffer log
format of one type and a buffer with a magic number of another.

This warning is not valid as the buffer update is ultimately skipped.
This is indicated by a current_lsn of NULLCOMMITLSN provided by the
caller. As such, update xlog_recover_validate_buf_type() to only warn in
such cases when a buffer update is expected.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 22db9af2
...@@ -2367,6 +2367,7 @@ xlog_recover_validate_buf_type( ...@@ -2367,6 +2367,7 @@ xlog_recover_validate_buf_type(
__uint32_t magic32; __uint32_t magic32;
__uint16_t magic16; __uint16_t magic16;
__uint16_t magicda; __uint16_t magicda;
char *warnmsg = NULL;
/* /*
* We can only do post recovery validation on items on CRC enabled * We can only do post recovery validation on items on CRC enabled
...@@ -2405,31 +2406,27 @@ xlog_recover_validate_buf_type( ...@@ -2405,31 +2406,27 @@ xlog_recover_validate_buf_type(
bp->b_ops = &xfs_rmapbt_buf_ops; bp->b_ops = &xfs_rmapbt_buf_ops;
break; break;
default: default:
xfs_warn(mp, "Bad btree block magic!"); warnmsg = "Bad btree block magic!";
ASSERT(0);
break; break;
} }
break; break;
case XFS_BLFT_AGF_BUF: case XFS_BLFT_AGF_BUF:
if (magic32 != XFS_AGF_MAGIC) { if (magic32 != XFS_AGF_MAGIC) {
xfs_warn(mp, "Bad AGF block magic!"); warnmsg = "Bad AGF block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_agf_buf_ops; bp->b_ops = &xfs_agf_buf_ops;
break; break;
case XFS_BLFT_AGFL_BUF: case XFS_BLFT_AGFL_BUF:
if (magic32 != XFS_AGFL_MAGIC) { if (magic32 != XFS_AGFL_MAGIC) {
xfs_warn(mp, "Bad AGFL block magic!"); warnmsg = "Bad AGFL block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_agfl_buf_ops; bp->b_ops = &xfs_agfl_buf_ops;
break; break;
case XFS_BLFT_AGI_BUF: case XFS_BLFT_AGI_BUF:
if (magic32 != XFS_AGI_MAGIC) { if (magic32 != XFS_AGI_MAGIC) {
xfs_warn(mp, "Bad AGI block magic!"); warnmsg = "Bad AGI block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_agi_buf_ops; bp->b_ops = &xfs_agi_buf_ops;
...@@ -2439,8 +2436,7 @@ xlog_recover_validate_buf_type( ...@@ -2439,8 +2436,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_GDQUOT_BUF: case XFS_BLFT_GDQUOT_BUF:
#ifdef CONFIG_XFS_QUOTA #ifdef CONFIG_XFS_QUOTA
if (magic16 != XFS_DQUOT_MAGIC) { if (magic16 != XFS_DQUOT_MAGIC) {
xfs_warn(mp, "Bad DQUOT block magic!"); warnmsg = "Bad DQUOT block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_dquot_buf_ops; bp->b_ops = &xfs_dquot_buf_ops;
...@@ -2452,16 +2448,14 @@ xlog_recover_validate_buf_type( ...@@ -2452,16 +2448,14 @@ xlog_recover_validate_buf_type(
break; break;
case XFS_BLFT_DINO_BUF: case XFS_BLFT_DINO_BUF:
if (magic16 != XFS_DINODE_MAGIC) { if (magic16 != XFS_DINODE_MAGIC) {
xfs_warn(mp, "Bad INODE block magic!"); warnmsg = "Bad INODE block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_inode_buf_ops; bp->b_ops = &xfs_inode_buf_ops;
break; break;
case XFS_BLFT_SYMLINK_BUF: case XFS_BLFT_SYMLINK_BUF:
if (magic32 != XFS_SYMLINK_MAGIC) { if (magic32 != XFS_SYMLINK_MAGIC) {
xfs_warn(mp, "Bad symlink block magic!"); warnmsg = "Bad symlink block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_symlink_buf_ops; bp->b_ops = &xfs_symlink_buf_ops;
...@@ -2469,8 +2463,7 @@ xlog_recover_validate_buf_type( ...@@ -2469,8 +2463,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_DIR_BLOCK_BUF: case XFS_BLFT_DIR_BLOCK_BUF:
if (magic32 != XFS_DIR2_BLOCK_MAGIC && if (magic32 != XFS_DIR2_BLOCK_MAGIC &&
magic32 != XFS_DIR3_BLOCK_MAGIC) { magic32 != XFS_DIR3_BLOCK_MAGIC) {
xfs_warn(mp, "Bad dir block magic!"); warnmsg = "Bad dir block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_dir3_block_buf_ops; bp->b_ops = &xfs_dir3_block_buf_ops;
...@@ -2478,8 +2471,7 @@ xlog_recover_validate_buf_type( ...@@ -2478,8 +2471,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_DIR_DATA_BUF: case XFS_BLFT_DIR_DATA_BUF:
if (magic32 != XFS_DIR2_DATA_MAGIC && if (magic32 != XFS_DIR2_DATA_MAGIC &&
magic32 != XFS_DIR3_DATA_MAGIC) { magic32 != XFS_DIR3_DATA_MAGIC) {
xfs_warn(mp, "Bad dir data magic!"); warnmsg = "Bad dir data magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_dir3_data_buf_ops; bp->b_ops = &xfs_dir3_data_buf_ops;
...@@ -2487,8 +2479,7 @@ xlog_recover_validate_buf_type( ...@@ -2487,8 +2479,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_DIR_FREE_BUF: case XFS_BLFT_DIR_FREE_BUF:
if (magic32 != XFS_DIR2_FREE_MAGIC && if (magic32 != XFS_DIR2_FREE_MAGIC &&
magic32 != XFS_DIR3_FREE_MAGIC) { magic32 != XFS_DIR3_FREE_MAGIC) {
xfs_warn(mp, "Bad dir3 free magic!"); warnmsg = "Bad dir3 free magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_dir3_free_buf_ops; bp->b_ops = &xfs_dir3_free_buf_ops;
...@@ -2496,8 +2487,7 @@ xlog_recover_validate_buf_type( ...@@ -2496,8 +2487,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_DIR_LEAF1_BUF: case XFS_BLFT_DIR_LEAF1_BUF:
if (magicda != XFS_DIR2_LEAF1_MAGIC && if (magicda != XFS_DIR2_LEAF1_MAGIC &&
magicda != XFS_DIR3_LEAF1_MAGIC) { magicda != XFS_DIR3_LEAF1_MAGIC) {
xfs_warn(mp, "Bad dir leaf1 magic!"); warnmsg = "Bad dir leaf1 magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_dir3_leaf1_buf_ops; bp->b_ops = &xfs_dir3_leaf1_buf_ops;
...@@ -2505,8 +2495,7 @@ xlog_recover_validate_buf_type( ...@@ -2505,8 +2495,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_DIR_LEAFN_BUF: case XFS_BLFT_DIR_LEAFN_BUF:
if (magicda != XFS_DIR2_LEAFN_MAGIC && if (magicda != XFS_DIR2_LEAFN_MAGIC &&
magicda != XFS_DIR3_LEAFN_MAGIC) { magicda != XFS_DIR3_LEAFN_MAGIC) {
xfs_warn(mp, "Bad dir leafn magic!"); warnmsg = "Bad dir leafn magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_dir3_leafn_buf_ops; bp->b_ops = &xfs_dir3_leafn_buf_ops;
...@@ -2514,8 +2503,7 @@ xlog_recover_validate_buf_type( ...@@ -2514,8 +2503,7 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_DA_NODE_BUF: case XFS_BLFT_DA_NODE_BUF:
if (magicda != XFS_DA_NODE_MAGIC && if (magicda != XFS_DA_NODE_MAGIC &&
magicda != XFS_DA3_NODE_MAGIC) { magicda != XFS_DA3_NODE_MAGIC) {
xfs_warn(mp, "Bad da node magic!"); warnmsg = "Bad da node magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_da3_node_buf_ops; bp->b_ops = &xfs_da3_node_buf_ops;
...@@ -2523,24 +2511,21 @@ xlog_recover_validate_buf_type( ...@@ -2523,24 +2511,21 @@ xlog_recover_validate_buf_type(
case XFS_BLFT_ATTR_LEAF_BUF: case XFS_BLFT_ATTR_LEAF_BUF:
if (magicda != XFS_ATTR_LEAF_MAGIC && if (magicda != XFS_ATTR_LEAF_MAGIC &&
magicda != XFS_ATTR3_LEAF_MAGIC) { magicda != XFS_ATTR3_LEAF_MAGIC) {
xfs_warn(mp, "Bad attr leaf magic!"); warnmsg = "Bad attr leaf magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_attr3_leaf_buf_ops; bp->b_ops = &xfs_attr3_leaf_buf_ops;
break; break;
case XFS_BLFT_ATTR_RMT_BUF: case XFS_BLFT_ATTR_RMT_BUF:
if (magic32 != XFS_ATTR3_RMT_MAGIC) { if (magic32 != XFS_ATTR3_RMT_MAGIC) {
xfs_warn(mp, "Bad attr remote magic!"); warnmsg = "Bad attr remote magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_attr3_rmt_buf_ops; bp->b_ops = &xfs_attr3_rmt_buf_ops;
break; break;
case XFS_BLFT_SB_BUF: case XFS_BLFT_SB_BUF:
if (magic32 != XFS_SB_MAGIC) { if (magic32 != XFS_SB_MAGIC) {
xfs_warn(mp, "Bad SB block magic!"); warnmsg = "Bad SB block magic!";
ASSERT(0);
break; break;
} }
bp->b_ops = &xfs_sb_buf_ops; bp->b_ops = &xfs_sb_buf_ops;
...@@ -2557,6 +2542,15 @@ xlog_recover_validate_buf_type( ...@@ -2557,6 +2542,15 @@ xlog_recover_validate_buf_type(
xfs_blft_from_flags(buf_f)); xfs_blft_from_flags(buf_f));
break; break;
} }
/*
* Don't warn in the case of a NULL current LSN as this means the buffer
* is more recent than the change in the log and will be skipped.
*/
if (warnmsg && current_lsn != NULLCOMMITLSN) {
xfs_warn(mp, warnmsg);
ASSERT(0);
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment