]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix to call nullptr when cancel_manifest_ops 39217/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 2 Feb 2021 06:43:14 +0000 (15:43 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 2 Feb 2021 06:43:14 +0000 (15:43 +0900)
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 <myoungwon.oh@samsumg.com>
src/osd/PrimaryLogPG.cc

index 663b8fb011d5b011d8645cb596aaf435a1745b9e..4c982be482e0d574684679f3bc9805e84f18420a 100644 (file)
@@ -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<ceph_tid_t> *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++);
   }
 }