From 04c0196b62463d5d88a48c7e338bbaea6f7193c0 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 7 Jun 2021 16:40:06 +0000 Subject: [PATCH] crimson/os/alienstore: open_collection() returns nullptr if DNE. This is an AlienStore's counterpart of 9fbd60131b5396beb81ce745c9ccf01388f7e303 which becomes necessary as, since 6b66c30b2331f0d42c8a51446ab04714047084b6, we call `open_collection()` to check the existence of OSD's superblock. Without this fix the following crash happens: ``` [rzarzynski@o06 build]$ MDS=0 MGR=0 OSD=1 ../src/vstart.sh -l -n --without-dashboard --crimson ... crimson-osd: boost/include/boost/smart_ptr/intrusive_ptr.hpp:199: T* boost::intrusive_ptr::operator->() const [with T = ObjectStore::CollectionImpl]: Assertion `px != 0' failed. Aborting on shard 0. Backtrace: 0# print_backtrace(std::basic_string_view >) at /home/rzarzynski/ceph1/build/boost/include/boost/stacktrace/stacktrace.hpp:129 1# FatalSignal::signaled(int, siginfo_t const*) at /home/rzarzynski/ceph1/build/../src/crimson/common/fatal_signal.cc:80 2# FatalSignal::install_oneshot_signal_handler<6>()::{lambda(int, siginfo_t*, void*)#1}::operator()(int, siginfo_t*, void*) const at /home/rzarzynski/ceph1/build/../src/crimson/common/fatal_signal.cc:41 3# FatalSignal::install_oneshot_signal_handler<6>()::{lambda(int, siginfo_t*, void*)#1}::_FUN(int, siginfo_t*, void*) at /home/rzarzynski/ceph1/build/../src/crimson/common/fatal_signal.cc:36 4# 0x00007F8BF534DB30 in /lib64/libpthread.so.0 5# gsignal in /lib64/libc.so.6 6# abort in /lib64/libc.so.6 7# 0x00007F8BF3948B19 in /lib64/libc.so.6 8# 0x00007F8BF3956DF6 in /lib64/libc.so.6 9# boost::intrusive_ptr::operator->() const at /home/rzarzynski/ceph1/build/boost/include/boost/smart_ptr/intrusive_ptr.hpp:200 10# crimson::os::AlienStore::open_collection(coll_t const&)::{lambda(boost::intrusive_ptr)#2}::operator()(boost::intrusive_ptr) const at /home/rzarzynski/ceph1/build/../src/crimson/os/alienstore/alien_store.cc:214 11# seastar::future > seastar::futurize > >::invoke)#2}&, boost::intrusive_ptr >(crimson::os::AlienStore::open_collection(coll_t const&)::{lambda(boost::intrusive_ptr)#2}&, boost::intrusive_ptr&&) at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:2135 12# auto seastar::futurize_invoke)#2}&, boost::intrusive_ptr >(crimson::os::AlienStore::open_collection(coll_t const&)::{lambda(boost::intrusive_ptr)#2}&, boost::intrusive_ptr&&) at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:2167 13# _ZZN7seastar6futureIN5boost13intrusive_ptrIN11ObjectStore14CollectionImplEEEE4thenIZN7crimson2os10AlienStore15open_collectionERK6coll_tEUlS5_E0_NS0_INS2_INS9_19FuturizedCollectionEEEEEEET0_OT_ENUlDpOT_E_clIJS5_EEEDaSN_ at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:1526 14# _ZN7seastar20noncopyable_functionIFNS_6futureIN5boost13intrusive_ptrIN7crimson2os19FuturizedCollectionEEEEEONS3_IN11ObjectStore14CollectionImplEEEEE17direct_vtable_forIZNS1_ISB_E4thenIZNS5_10AlienStore15open_collectionERK6coll_tEUlSB_E0_S8_EET0_OT_EUlDpOT_E_E4callEPKSE_SC_ at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/util/noncopyable_function.hh:125 15# seastar::noncopyable_function > (boost::intrusive_ptr&&)>::operator()(boost::intrusive_ptr&&) const at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/util/noncopyable_function.hh:210 16# seastar::future > std::__invoke_impl >, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr >(std::__invoke_other, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr&&) at /opt/rh/gcc-toolset-9/root/usr/include/c++/9/bits/invoke.h:60 17# std::__invoke_result > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr >::type std::__invoke > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr&&) at /opt/rh/gcc-toolset-9/root/usr/include/c++/9/bits/invoke.h:97 18# std::invoke_result > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr >::type std::invoke > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr&&) at /opt/rh/gcc-toolset-9/root/usr/include/c++/9/functional:83 19# auto seastar::internal::future_invoke > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, boost::intrusive_ptr&&) at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:1213 20# seastar::future >::then_impl_nrvo > (boost::intrusive_ptr&&)>, seastar::future > >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&&)::{lambda(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&)#1}::operator()(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&) const::{lambda()#1}::operator()() const at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:1575 21# void seastar::futurize > >::satisfy_with_result_of >::then_impl_nrvo > (boost::intrusive_ptr&&)>, seastar::future > >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&&)::{lambda(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&)#1}::operator()(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&) const::{lambda()#1}>(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&&) at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:2120 22# seastar::future >::then_impl_nrvo > (boost::intrusive_ptr&&)>, seastar::future > >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&&)::{lambda(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&)#1}::operator()(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&) const at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:1571 23# seastar::continuation >, seastar::noncopyable_function > (boost::intrusive_ptr&&)>, seastar::future >::then_impl_nrvo > (boost::intrusive_ptr&&)>, seastar::future > >(seastar::noncopyable_function > (boost::intrusive_ptr&&)>&&)::{lambda(seastar::internal::promise_base_with_type >&&, seastar::noncopyable_function > (boost::intrusive_ptr&&)>&, seastar::future_state >&&)#1}, boost::intrusive_ptr >::run_and_dispose() at /home/rzarzynski/ceph1/build/../src/seastar/include/seastar/core/future.hh:771 24# seastar::reactor::run_tasks(seastar::reactor::task_queue&) at /home/rzarzynski/ceph1/build/../src/seastar/src/core/reactor.cc:2237 25# seastar::reactor::run_some_tasks() at /home/rzarzynski/ceph1/build/../src/seastar/src/core/reactor.cc:2646 (discriminator 1) 26# seastar::reactor::run() at /home/rzarzynski/ceph1/build/../src/seastar/src/core/reactor.cc:2805 27# seastar::app_template::run_deprecated(int, char**, std::function&&) at /home/rzarzynski/ceph1/build/../src/seastar/src/core/app-template.cc:207 (discriminator 7) 28# seastar::app_template::run(int, char**, std::function ()>&&) at /home/rzarzynski/ceph1/build/../src/seastar/src/core/app-template.cc:115 (discriminator 2) 29# main at /home/rzarzynski/ceph1/build/../src/crimson/osd/main.cc:206 (discriminator 1) 30# __libc_start_main in /lib64/libc.so.6 31# _start in /home/rzarzynski/ceph1/build/bin/crimson-osd Reactor stalled for 33157 ms on shard 0. Backtrace: 0xb14ab 0xa6cd418 0xa6a496d 0xa54fd22 0xa566e3d 0xa56383c 0xa5639fc 0xa566808 0x12b2f 0x3780e 0x21c44 0x21b18 0x2fdf5 0x7cfdf93 0x7b78622 0x7c3fcb7 0x7c1bcb2 0x7c1bdf1 0x7c4004a 0x7d913c7 0x7d875ed 0x7d777d7 0x7d5f626 0x7d47ca4 0x7d47b5a 0x7d5f770 0x7d47931 0x7d9bb74 0xa5998b5 0xa59e1ff 0xa5a3a95 0xa43546c 0xa433331 0x3f01992 0x237c2 0x3c7f9bd ../src/vstart.sh: line 28: 665993 Aborted (core dumped) PATH=$CEPH_BIN:$PATH "$@" ``` Signed-off-by: Radoslaw Zarzynski --- src/crimson/os/alienstore/alien_store.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/crimson/os/alienstore/alien_store.cc b/src/crimson/os/alienstore/alien_store.cc index ccf5a22246b8d..4f6eb4b8665cf 100644 --- a/src/crimson/os/alienstore/alien_store.cc +++ b/src/crimson/os/alienstore/alien_store.cc @@ -210,6 +210,9 @@ seastar::future AlienStore::open_collection(const coll_t& cid) return tp->submit([this, cid] { return store->open_collection(cid); }).then([this] (ObjectStore::CollectionHandle c) { + if (!c) { + return seastar::make_ready_future(); + } CollectionRef ch; auto cp = coll_map.find(c->cid); if (cp == coll_map.end()){ -- 2.39.5