]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix log block underflow during recovery cycle verification
authorBrian Foster <bfoster@redhat.com>
Thu, 26 Oct 2017 16:31:16 +0000 (09:31 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 26 Oct 2017 22:38:29 +0000 (15:38 -0700)
commitceb39e97533a9c3f7144850ac62fe6c3c1a59883
treef65ee58abfa0e2707ad84eb6b73a8f44641c6691
parente0b9a719c4a7ade23f84989e9cad9f60a2b5e482
xfs: fix log block underflow during recovery cycle verification

It is possible for mkfs to format very small filesystems with too
small of an internal log with respect to the various minimum size
and block count requirements. If this occurs when the log happens to
be smaller than the scan window used for cycle verification and the
scan wraps the end of the log, the start_blk calculation in
xlog_find_head() underflows and leads to an attempt to scan an
invalid range of log blocks. This results in log recovery failure
and a failed mount.

Since there may be filesystems out in the wild with this kind of
geometry, we cannot simply refuse to mount. Instead, cap the scan
window for cycle verification to the size of the physical log. This
ensures that the cycle verification proceeds as expected when the
scan wraps the end of the log.

Reported-by: Zorro Lang <zlang@redhat.com>
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