XArray: Fix xas_pause at ULONG_MAX
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 8 Nov 2019 03:49:11 +0000 (22:49 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Feb 2020 21:22:47 +0000 (21:22 +0000)
commit08022255a9ee926896e81ba63a83bb904efe446d
tree730f432f7a97b8708b007a9a834aabfb0b4bbae5
parentb267caf5e51f207c68e67aee47380a6c8fde7840
XArray: Fix xas_pause at ULONG_MAX

[ Upstream commit 82a22311b7a68a78709699dc8c098953b70e4fd2 ]

If we were unlucky enough to call xas_pause() when the index was at
ULONG_MAX (or a multi-slot entry which ends at ULONG_MAX), we would
wrap the index back around to 0 and restart the iteration from the
beginning.  Use the XAS_BOUNDS state to indicate that we should just
stop the iteration.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/test_xarray.c
lib/xarray.c