xfs: add CRC checks to the AGI
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_log_recover.c
index da2a19e0554e78dc8150729e49418ffd16c28d83..6778a7943db435386be4c5e23052763c0f1fc7ea 100644 (file)
@@ -1971,6 +1971,14 @@ xlog_recover_do_reg_buffer(
                }
                bp->b_ops = &xfs_agfl_buf_ops;
                break;
+       case XFS_BLF_AGI_BUF:
+               if (*(__be32 *)bp->b_addr != cpu_to_be32(XFS_AGI_MAGIC)) {
+                       xfs_warn(mp, "Bad AGI block magic!");
+                       ASSERT(0);
+                       break;
+               }
+               bp->b_ops = &xfs_agi_buf_ops;
+               break;
        default:
                break;
        }