Skip to content

Commit 9039d61

Browse files
authored
Merge pull request ceph#60913 from myoungwon/wip-fix-null-pointer-crimson
crimson/osd/ops_executer: prevent access to null pointers caused by gcc bug Reviewed-by: Yingxin Cheng <[email protected]> Reviewed-by: Samuel Just <[email protected]> Reviewed-by: Xuehan Xu <[email protected]>
2 parents 0065f9e + b5665cf commit 9039d61

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/crimson/osd/ops_executer.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,14 +517,21 @@ OpsExecuter::flush_changes_n_do_ops_effects(
517517
ceph_assert(log_rit->version == osd_op_params->at_version);
518518
}
519519

520+
/*
521+
* This works around the gcc bug causing the generated code to incorrectly
522+
* execute unconditionally before the predicate.
523+
*
524+
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101244
525+
*/
526+
auto clone_obc = cloning_ctx
527+
? std::move(cloning_ctx->clone_obc)
528+
: nullptr;
520529
auto [_submitted, _all_completed] = co_await mut_func(
521530
std::move(txn),
522531
std::move(obc),
523532
std::move(*osd_op_params),
524533
std::move(log_entries),
525-
cloning_ctx
526-
? std::move(cloning_ctx->clone_obc)
527-
: nullptr);
534+
std::move(clone_obc));
528535

529536
submitted = std::move(_submitted);
530537
all_completed = std::move(_all_completed);

0 commit comments

Comments
 (0)