From: Radoslaw Zarzynski Date: Fri, 14 Mar 2025 15:44:12 +0000 (+0000) Subject: *, do not rely on always-false ceph_asserts to terminate execution X-Git-Tag: v20.3.0~189^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a5d43f41928ba9c52d43f5446a10d4b124d5ce5;p=ceph.git *, do not rely on always-false ceph_asserts to terminate execution Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/common/perf_histogram.cc b/src/common/perf_histogram.cc index 13528764ade9..772cc5e2cdc3 100644 --- a/src/common/perf_histogram.cc +++ b/src/common/perf_histogram.cc @@ -33,7 +33,7 @@ void PerfHistogramCommon::dump_formatted_axis( f->dump_string("scale_type", "log2"); break; default: - ceph_assert(false && "Invalid scale type"); + ceph_abort_msg("Invalid scale type"); } { @@ -63,7 +63,7 @@ int64_t get_quants(int64_t i, PerfHistogramCommon::scale_type_d st) { case PerfHistogramCommon::SCALE_LOG2: return int64_t(1) << (i - 1); } - ceph_assert(false && "Invalid scale type"); + ceph_abort_msg("Invalid scale type"); } int64_t PerfHistogramCommon::get_bucket_for_axis( @@ -87,7 +87,7 @@ int64_t PerfHistogramCommon::get_bucket_for_axis( } return ac.m_buckets - 1; } - ceph_assert(false && "Invalid scale type"); + ceph_abort_msg("Invalid scale type"); } std::vector> diff --git a/src/crimson/os/alienstore/alien_store.cc b/src/crimson/os/alienstore/alien_store.cc index db6decd84f94..c44abe46ae95 100644 --- a/src/crimson/os/alienstore/alien_store.cc +++ b/src/crimson/os/alienstore/alien_store.cc @@ -638,7 +638,7 @@ auto AlienStore::omap_get_header(CollectionRef ch, return crimson::ct_error::enoent::make(); } else if (r < 0) { logger().error("omap_get_header: {}", r); - ceph_assert(0 == "impossible"); + ceph_abort_msg("impossible"); } else { return get_attr_errorator::make_ready_future( std::move(bl)); diff --git a/src/crimson/osd/scheduler/mclock_scheduler.cc b/src/crimson/osd/scheduler/mclock_scheduler.cc index 2fcf6d57db47..3de2327f59c0 100644 --- a/src/crimson/osd/scheduler/mclock_scheduler.cc +++ b/src/crimson/osd/scheduler/mclock_scheduler.cc @@ -123,12 +123,12 @@ item_t mClockScheduler::dequeue() } else { mclock_queue_t::PullReq result = scheduler.pull_request(); if (result.is_future()) { - ceph_assert( - 0 == "Not implemented, user would have to be able to be woken up"); + ceph_abort_msg( + "Not implemented, user would have to be able to be woken up"); return std::move(*(item_t*)nullptr); } else if (result.is_none()) { - ceph_assert( - 0 == "Impossible, must have checked empty() first"); + ceph_abort_msg( + "Impossible, must have checked empty() first"); return std::move(*(item_t*)nullptr); } else { ceph_assert(result.is_retn()); diff --git a/src/librbd/crypto/CryptoContextPool.h b/src/librbd/crypto/CryptoContextPool.h index 00486dacdd65..9b6a9898b8cb 100644 --- a/src/librbd/crypto/CryptoContextPool.h +++ b/src/librbd/crypto/CryptoContextPool.h @@ -57,7 +57,7 @@ private: case CIPHER_MODE_DEC: return m_decrypt_contexts; default: - ceph_assert(false); + ceph_abort(); } } }; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index c0454e2689e3..4ad4dab72c39 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -4156,10 +4156,10 @@ struct AnonConnection : public Connection { entity_addr_t socket_addr; int send_message(Message *m) override { - ceph_assert(!"send_message on anonymous connection"); + ceph_abort_msg("send_message on anonymous connection"); } void send_keepalive() override { - ceph_assert(!"send_keepalive on anonymous connection"); + ceph_abort_msg("send_keepalive on anonymous connection"); } void mark_down() override { // silently ignore diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 7dca7f49f1e5..6de5d1ed41af 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -10143,7 +10143,7 @@ public: } /// Check whether there is anything to do. bool _empty() override { - ceph_assert(false); + ceph_abort(); } /// Get the next work item to process. @@ -10210,7 +10210,7 @@ public: * so at most one copy will execute simultaneously for a given thread pool. * It can be used for non-thread-safe finalization. */ void _void_process_finish(void*) override { - ceph_assert(false); + ceph_abort(); } bool queue( diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 0d28d2716fc5..18bea62ba4fe 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -998,7 +998,7 @@ public: } loc -= e.length; } - ceph_assert(false); + ceph_abort(); }; /// updates blob's pextents container and return unused pextents eligible diff --git a/src/osd/scheduler/OpScheduler.cc b/src/osd/scheduler/OpScheduler.cc index 12e5bdb6c45f..efd4dc3303a9 100644 --- a/src/osd/scheduler/OpScheduler.cc +++ b/src/osd/scheduler/OpScheduler.cc @@ -43,7 +43,7 @@ OpSchedulerRef make_scheduler( mClockScheduler>(cct, whoami, num_shards, shard_id, is_rotational, op_queue_cut_off, monc); } else { - ceph_assert("Invalid choice of wq" == 0); + ceph_abort_msg("Invalid choice of wq"); } } diff --git a/src/test/crimson/seastore/test_extent_allocator.cc b/src/test/crimson/seastore/test_extent_allocator.cc index 87a5d0feb584..ece78e5c1d6d 100644 --- a/src/test/crimson/seastore/test_extent_allocator.cc +++ b/src/test/crimson/seastore/test_extent_allocator.cc @@ -38,7 +38,7 @@ struct allocator_test_t : allocator.reset(new AvlAllocator(false)); return seastar::now(); } - ceph_assert(0 == "no support"); + ceph_abort("no support"); } seastar::future<> tear_down_fut() final { if (allocator) { diff --git a/src/tools/immutable_object_cache/ObjectCacheStore.cc b/src/tools/immutable_object_cache/ObjectCacheStore.cc index d1fc911f43cd..4c74d6a24f86 100644 --- a/src/tools/immutable_object_cache/ObjectCacheStore.cc +++ b/src/tools/immutable_object_cache/ObjectCacheStore.cc @@ -276,7 +276,7 @@ int ObjectCacheStore::lookup_object(std::string pool_nspace, uint64_t pool_id, return ret; default: lderr(m_cct) << "unrecognized object cache status" << dendl; - ceph_assert(0); + ceph_abort(); } }