]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/ops_executer: prevent access to null pointers caused by gcc bug pull/60913/head 60913/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 2 Dec 2024 10:02:08 +0000 (10:02 +0000)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 4 Dec 2024 07:09:37 +0000 (15:09 +0800)
This commit assigns the parameter eariler to work around a coroutine related gcc bug
that causes a null pointer access.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/crimson/osd/ops_executer.h

index 94b64ccebb165575151132fea0c49bb8ece46edd..51436f19da7e98acb08aa5d67065b4b9e2406529 100644 (file)
@@ -517,14 +517,21 @@ OpsExecuter::flush_changes_n_do_ops_effects(
       ceph_assert(log_rit->version == osd_op_params->at_version);
     }
 
+    /*
+     * This works around the gcc bug causing the generated code to incorrectly
+     * execute unconditionally before the predicate.
+     *
+     * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101244
+     */
+    auto clone_obc = cloning_ctx
+       ? std::move(cloning_ctx->clone_obc)
+       : nullptr;
     auto [_submitted, _all_completed] = co_await mut_func(
       std::move(txn),
       std::move(obc),
       std::move(*osd_op_params),
       std::move(log_entries),
-      cloning_ctx
-       ? std::move(cloning_ctx->clone_obc)
-       : nullptr);
+      std::move(clone_obc));
 
     submitted = std::move(_submitted);
     all_completed = std::move(_all_completed);