diff -ruw a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc --- a/src/osd/ReplicatedPG.cc 2015-01-15 05:15:23.000000000 +1100 +++ b/src/osd/ReplicatedPG.cc 2015-02-18 14:37:03.000000000 +1100 @@ -2291,20 +2291,20 @@ } } -ReplicatedPG::RepGather *ReplicatedPG::trim_object(const hobject_t &coid) +int ReplicatedPG::trim_object(const hobject_t &coid, ReplicatedPG::RepGather** repgather) { // load clone info bufferlist bl; ObjectContextRef obc = get_object_context(coid, false, NULL); if (!obc) { derr << __func__ << "could not find coid " << coid << dendl; - assert(0); + return -ENOENT; } assert(obc->ssc); if (!obc->get_snaptrimmer_write()) { dout(10) << __func__ << ": Unable to get a wlock on " << coid << dendl; - return NULL; + return -EWOULDBLOCK; } hobject_t snapoid( @@ -2321,7 +2321,7 @@ obc->put_write(&to_wake, &requeue_recovery, &requeue_snaptrimmer); assert(to_wake.empty()); assert(!requeue_recovery); - return NULL; + return -EWOULDBLOCK; } object_info_t &coi = obc->obs.oi; @@ -2524,7 +2524,8 @@ } } - return repop; + *repgather = repop; + return 0; } void ReplicatedPG::snap_trimmer() @@ -12084,8 +12085,14 @@ } dout(10) << "TrimmingObjects react trimming " << pos << dendl; - RepGather *repop = pg->trim_object(pos); - if (!repop) { + RepGather *repop = NULL; + r = pg->trim_object(pos, &repop); + if (r == -ENOENT) { + pg->osd->clog.error() << "TrimmingObjects cannot find snap, dropping from snaptrimq: " << pos << "\n"; + post_event(SnapTrim()); + return transit< WaitingOnReplicas >(); + } + if (r == -EWOULDBLOCK) { dout(10) << __func__ << " could not get write lock on obj " << pos << dendl; pos = old_pos; diff -ruw a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h --- a/src/osd/ReplicatedPG.h 2015-01-15 05:15:23.000000000 +1100 +++ b/src/osd/ReplicatedPG.h 2015-02-18 14:37:03.000000000 +1100 @@ -1284,7 +1284,7 @@ ThreadPool::TPHandle &handle); void do_backfill(OpRequestRef op); - RepGather *trim_object(const hobject_t &coid); + int trim_object(const hobject_t &coid, RepGather** repgather); void snap_trimmer(); int do_osd_ops(OpContext *ctx, vector& ops);