xfs: always verify the log tail during recovery
authorBrian Foster <bfoster@redhat.com>
Wed, 9 Aug 2017 01:21:51 +0000 (18:21 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 22 Aug 2017 16:22:23 +0000 (09:22 -0700)
commit5297ac1f6d7cbf45464a49b9558831f271dfc559
treedcaa550d11b58a86e2990055f96f93822c6e89f9
parent284f1c2c9bebf871861184b0e2c40fa921dd380b
xfs: always verify the log tail during recovery

Log tail verification currently only occurs when torn writes are
detected at the head of the log. This was introduced because a
change in the head block due to torn writes can lead to a change in
the tail block (each log record header references the current tail)
and the tail block should be verified before log recovery proceeds.

Tail corruption is possible outside of torn write scenarios,
however. For example, partial log writes can be detected and cleared
during the initial head/tail block discovery process. If the partial
write coincides with a tail overwrite, the log tail is corrupted and
recovery fails.

To facilitate correct handling of log tail overwites, update log
recovery to always perform tail verification. This is necessary to
detect potential tail overwrite conditions when torn writes may not
have occurred. This changes normal (i.e., no torn writes) recovery
behavior slightly to detect and return CRC related errors near the
tail before actual recovery starts.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_log_recover.c