From d11906c4e818c86602325296eed67271553e8172 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 19 Oct 2018 02:08:54 -0400 Subject: [PATCH] roots: do not allow transid_min to be numeric_limits::max() On a few test machines max_transid on subvols is getting set to 18446744073709551615 (aka uint64_t max). Prevent transid_min() from ever returning this value. Signed-off-by: Zygo Blaxell --- src/bees-roots.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bees-roots.cc b/src/bees-roots.cc index 6e81968..cf28225 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -185,9 +185,12 @@ BeesRoots::transid_min() return 0; } uint64_t rv = numeric_limits::max(); + const uint64_t max_rv = rv; for (auto i : m_root_crawl_map) { rv = min(rv, i.second->get_state_end().m_min_transid); } + // If we get through this loop without setting rv, we'll create broken crawlers due to integer overflow. + THROW_CHECK2(runtime_error, rv, max_rv, max_rv > rv); return rv; }