From 88b364ba441bea02e8c0b64d3ab4fde56d19fe2f Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Tue, 2 Feb 2021 15:43:14 +0900 Subject: [PATCH] osd: fix to call nullptr when cancel_manifest_ops Segmentation fault can occur because cancel_manifest_ops must call callback without checking nullptr even though ManifestOp can be used with null callback in start_dedup() Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 663b8fb011d5b..4c982be482e0d 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3283,7 +3283,9 @@ struct C_SetManifestRefCountDone : public Context { // raced with cancel_manifest_ops return; } - it->second->cb->complete(r); + if (it->second->cb) { + it->second->cb->complete(r); + } pg->manifest_ops.erase(it); mop.reset(); } @@ -3322,8 +3324,10 @@ void PrimaryLogPG::cancel_manifest_ops(bool requeue, vector *tids) tids->push_back(mop->objecter_tid); mop->objecter_tid = 0; } - mop->cb->set_requeue(requeue); - mop->cb->complete(-ECANCELED); + if (mop->cb) { + mop->cb->set_requeue(requeue); + mop->cb->complete(-ECANCELED); + } manifest_ops.erase(p++); } } -- 2.39.5