]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::OpContext::start_async_reads: tolerate case sync callback call
authorSamuel Just <sjust@redhat.com>
Tue, 18 Oct 2016 21:46:53 +0000 (14:46 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 17 Nov 2016 18:41:33 +0000 (10:41 -0800)
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 <sjust@redhat.com>
src/osd/ReplicatedPG.cc

index a3d324938832e8d36ac875a871a2124fa1eee46a..4e01744519cc84722875fe9ff2f01eec5cded3fb 100644 (file)
@@ -246,11 +246,13 @@ class ReplicatedPG::C_OSD_AppliedRecoveredObjectReplica : public Context {
 void ReplicatedPG::OpContext::start_async_reads(ReplicatedPG *pg)
 {
   inflightreads = 1;
+  list<pair<boost::tuple<uint64_t, uint64_t, unsigned>,
+           pair<bufferlist*, Context*> > > 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)
 {