From af5c747a808d1c6cf5c4e7f87096e53735a29a4a Mon Sep 17 00:00:00 2001 From: David Zafman Date: Sat, 16 Feb 2019 09:37:36 -0800 Subject: [PATCH] osd: Prevent negative local num_bytes sent to peer for backfill reservation Fixes: http://tracker.ceph.com/issues/38344 Signed-off-by: David Zafman --- src/osd/PG.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 0cafa2030c5dc..295d30f47e5ba 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2003,8 +2003,8 @@ void PG::activate(ObjectStore::Transaction& t, pi.last_interval_started = info.last_interval_started; pi.history = info.history; pi.hit_set = info.hit_set; - // Save num_bytes for reservation request - peer_bytes[peer] = pi.stats.stats.sum.num_bytes; + // Save num_bytes for reservation request, can't be negative + peer_bytes[peer] = std::max(0, pi.stats.stats.sum.num_bytes); pi.stats.stats.clear(); // initialize peer with our purged_snaps. -- 2.39.5