From: Sage Weil Date: Wed, 21 Sep 2011 22:46:37 +0000 (-0700) Subject: osd: fix PG::copy_after vs backlog X-Git-Tag: v0.36~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=68fe748fc2d703623050e8f2a448a0fd31ca8a0f;p=ceph.git osd: fix PG::copy_after vs backlog If you call copy_after(..., 0) on a log with a backlog, you get all the backlog entries, but no backlog flag. That's invalid. You either need the _complete_ backlog + the flag, or no backlog entries; getting only some of them is useless information. Make copy_after stop when it hits the tail. Callers who need the backlog are already checking for that and copying the whole log as appropriate. Signed-off-by: Sage Weil --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index fa3dbd803a91..de0ee124b669 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -56,7 +56,7 @@ void PG::Log::copy_after(const Log &other, eversion_t v) for (list::const_reverse_iterator i = other.log.rbegin(); i != other.log.rend(); i++) { - if (i->version <= v) { + if (i->version <= v || i->version <= other.tail) { tail = i->version; break; } @@ -3504,8 +3504,7 @@ void PG::fulfill_log(int from, const Query &query) } else mlog->log.copy_after(log, query.since); } - - if (query.type == PG::Query::BACKLOG) { + else if (query.type == PG::Query::BACKLOG) { dout(10) << "sending info+missing+backlog" << dendl; assert(log.backlog); mlog->log = log;