From c5180262a086c2d3895aff4bf0fb0ff9a6666149 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 10 Nov 2016 13:56:24 -0500 Subject: [PATCH] os/filestore/HashIndex: fix list_by_hash_* termination on reaching end If we set *next to max, then the caller (a few lines up) doesn't terminate the loop and will keep trying to list objects in every following hash dir until it reaches the end of the collection. In fact, if we have an end bound we will never to an efficient listing unless we hit the max first. For one user, this was causing OSD suicides when scrub ran because it wasn't able to list all objects before the timeout. In general, this would cause scrub to stall a PG for a long time and slow down requests. Broken by refactor in 921c4586f165ce39c17ef8b579c548dc8f6f4500. Fixes: http://tracker.ceph.com/issues/17859 Signed-off-by: Sage Weil --- src/os/filestore/HashIndex.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/filestore/HashIndex.cc b/src/os/filestore/HashIndex.cc index 606e1f57d90..1839a048836 100644 --- a/src/os/filestore/HashIndex.cc +++ b/src/os/filestore/HashIndex.cc @@ -1065,7 +1065,7 @@ int HashIndex::list_by_hash_bitwise( } if (cmp_bitwise(j->second, end) >= 0) { if (next) - *next = ghobject_t::get_max(); + *next = j->second; return 0; } if (!next || cmp_bitwise(j->second, *next) >= 0) { @@ -1131,7 +1131,7 @@ int HashIndex::list_by_hash_nibblewise( } if (cmp_nibblewise(j->second, end) >= 0) { if (next) - *next = ghobject_t::get_max(); + *next = j->second; return 0; } if (!next || cmp_nibblewise(j->second, *next) >= 0) { -- 2.39.5