From b237321bdafff2e3c7ba47f3a96d400f3cc7a040 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 18 Oct 2016 14:46:53 -0700 Subject: [PATCH] ReplicatedPG::OpContext::start_async_reads: tolerate case sync callback call If the read can be completed immediately, objects_read_async will call the callback syncronously, which will result in ctx being cleaned up. Clear pending_async_reads before the call. Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a3d32493883..4e01744519c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -246,11 +246,13 @@ class ReplicatedPG::C_OSD_AppliedRecoveredObjectReplica : public Context { void ReplicatedPG::OpContext::start_async_reads(ReplicatedPG *pg) { inflightreads = 1; + list, + pair > > in; + in.swap(pending_async_reads); pg->pgbackend->objects_read_async( obc->obs.oi.soid, - pending_async_reads, + in, new OnReadComplete(pg, this), pg->get_pool().fast_read); - pending_async_reads.clear(); } void ReplicatedPG::OpContext::finish_read(ReplicatedPG *pg) { -- 2.47.3