]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix to call nullptr when cancel_manifest_ops 39313/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 2 Feb 2021 06:43:14 +0000 (15:43 +0900)
committerNeha Ojha <nojha@redhat.com>
Fri, 5 Feb 2021 01:43:53 +0000 (01:43 +0000)
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>
(cherry picked from commit 88b364ba441bea02e8c0b64d3ab4fde56d19fe2f)

src/osd/PrimaryLogPG.cc

index 4427bff8249e2444c93c8a1aa090f29e4ea825e8..9d5763fe6cade96d4d6ae17cacff169ce3744467 100644 (file)
@@ -3287,7 +3287,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();
   }
@@ -3326,8 +3328,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++);
   }
 }