From 373b9ef03844cc2def09a3a39e2da778908afc4a Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 19 Oct 2018 02:12:22 -0400 Subject: [PATCH] roots: fix subvol scan rollover on subvols with empty transid range The ordering function for BeesCrawlState did not consider root 292 inode 0 min_transid 2345 max_transid 3456 to be larger than root 292 inode 258 min_transid 2345 max_transid 2345 so when we attempted to update the end pointer for the crawl progress, the new state was not considered newer than the old state because the min_transid was equal, but the new crawl state's inode number was smaller. Normally this is not a problem because subvol scans typically begin and end in separate transactions (in part because we don't start a subvol scan until at least two transactions are available); however, the cleanup code for the aftermath of the recent transid_min() bug can create crawlers with equal max_transid and min_transid records. Fix this by ordering both transid fields before any others in the crawl state. Signed-off-by: Zygo Blaxell --- src/bees-roots.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bees-roots.cc b/src/bees-roots.cc index ed1dc8a..2e92583 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -46,8 +46,8 @@ BeesCrawlState::BeesCrawlState() : bool BeesCrawlState::operator<(const BeesCrawlState &that) const { - return tie(m_min_transid, m_objectid, m_offset, m_root, m_max_transid) - < tie(that.m_min_transid, that.m_objectid, that.m_offset, that.m_root, that.m_max_transid); + return tie(m_min_transid, m_max_transid, m_objectid, m_offset, m_root) + < tie(that.m_min_transid, that.m_max_transid, that.m_objectid, that.m_offset, that.m_root); } string