Skip to content

Commit

Permalink
os/filestore/HashIndex: fix list_by_hash_* termination on reaching end
Browse files Browse the repository at this point in the history
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 921c458.

Fixes: http://tracker.ceph.com/issues/17859
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Nov 10, 2016
1 parent f1476e2 commit c518026
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/os/filestore/HashIndex.cc
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c518026

Please sign in to comment.