]> git.proxmox.com Git - mirror_ubuntu-artful-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 13 Mar 2018 10:28:34 +0000 (11:28 +0100)
commit78862afb4d58cc051f3d429043f5f4d5e7ebdcb7
tree65c2988c1be852b7d857b2a1bf94745c3e69cc81
parent409dc5cf59d16ca7304e9b0c9a38ad36403f9644
xfs: fix log block underflow during recovery cycle verification

BugLink: http://bugs.launchpad.net/bugs/1745052
[ Upstream commit 9f2a4505800607e537e9dd9dea4f55c4b0c30c7a ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/xfs/xfs_log_recover.c