Skip to content

Commit

Permalink
Merge pull request #13342 from athanatos/wip-17831-18583-18809
Browse files Browse the repository at this point in the history
osd/: don't leak context for Blessed*Context or RecoveryQueueAsync

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Josh Durgin <jdurgin@redhat.com>
  • Loading branch information
athanatos committed Feb 10, 2017
2 parents 880cbf0 + 91b7423 commit 534ae8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/osd/PrimaryLogPG.cc
Expand Up @@ -126,17 +126,17 @@ class PrimaryLogPG::CopyCallback : public GenContext<CopyCallbackResults> {
template <typename T>
class PrimaryLogPG::BlessedGenContext : public GenContext<T> {
PrimaryLogPGRef pg;
GenContext<T> *c;
unique_ptr<GenContext<T>> c;
epoch_t e;
public:
BlessedGenContext(PrimaryLogPG *pg, GenContext<T> *c, epoch_t e)
: pg(pg), c(c), e(e) {}
void finish(T t) {
pg->lock();
if (pg->pg_has_reset_since(e))
delete c;
c.reset();
else
c->complete(t);
c.release()->complete(t);
pg->unlock();
}
};
Expand All @@ -149,17 +149,17 @@ GenContext<ThreadPool::TPHandle&> *PrimaryLogPG::bless_gencontext(

class PrimaryLogPG::BlessedContext : public Context {
PrimaryLogPGRef pg;
Context *c;
unique_ptr<Context> c;
epoch_t e;
public:
BlessedContext(PrimaryLogPG *pg, Context *c, epoch_t e)
: pg(pg), c(c), e(e) {}
void finish(int r) {
pg->lock();
if (pg->pg_has_reset_since(e))
delete c;
c.reset();
else
c->complete(r);
c.release()->complete(r);
pg->unlock();
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/osd/ReplicatedBackend.cc
Expand Up @@ -49,13 +49,13 @@ class PG_SendMessageOnConn: public Context {

class PG_RecoveryQueueAsync : public Context {
PGBackend::Listener *pg;
GenContext<ThreadPool::TPHandle&> *c;
unique_ptr<GenContext<ThreadPool::TPHandle&>> c;
public:
PG_RecoveryQueueAsync(
PGBackend::Listener *pg,
GenContext<ThreadPool::TPHandle&> *c) : pg(pg), c(c) {}
void finish(int) {
pg->schedule_recovery_work(c);
pg->schedule_recovery_work(c.release());
}
};
}
Expand Down

0 comments on commit 534ae8f

Please sign in to comment.