From: Xuehan Xu Date: Fri, 13 Aug 2021 13:57:48 +0000 (+0800) Subject: crimson/os/seastore: deal with transaction conflicts when doing mkfs X-Git-Tag: v17.1.0~919^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4f91ac0b6c2088b4117818367502bdd803987680;p=ceph-ci.git crimson/os/seastore: deal with transaction conflicts when doing mkfs Cleaner transactions can conflict with mkfs transactions, retry mkfs transactions when that happens Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 0e6772bff71..295518d4364 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -119,15 +119,17 @@ seastar::future<> SeaStore::mkfs(uuid_d new_osd_fsid) }).safe_then([this] { return transaction_manager->mount(); }).safe_then([this] { - return transaction_manager->with_transaction_intr( - Transaction::src_t::MUTATE, [this](auto& t) { - return onode_manager->mkfs(t - ).si_then([this, &t] { - return collection_manager->mkfs(t); - }).si_then([this, &t](auto coll_root) { - transaction_manager->write_collection_root( - t, coll_root); - return transaction_manager->submit_transaction(t); + return repeat_eagain([this] { + return transaction_manager->with_transaction_intr( + Transaction::src_t::MUTATE, [this](auto& t) { + return onode_manager->mkfs(t + ).si_then([this, &t] { + return collection_manager->mkfs(t); + }).si_then([this, &t](auto coll_root) { + transaction_manager->write_collection_root( + t, coll_root); + return transaction_manager->submit_transaction(t); + }); }); }); }).safe_then([this] { diff --git a/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc b/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc index b132ec29dd2..b52a79e29a7 100644 --- a/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc +++ b/src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc @@ -84,16 +84,18 @@ struct fltree_onode_manager_test_t ).then([this] { return tm->mount( ).safe_then([this] { - return seastar::do_with( - create_mutate_transaction(), - [this](auto &ref_t) { - return with_trans_intr(*ref_t, [&](auto &t) { - return manager->mkfs(t - ).si_then([this, &t] { - return submit_transaction_fut2(t); + return repeat_eagain([this] { + return seastar::do_with( + create_mutate_transaction(), + [this](auto &ref_t) { + return with_trans_intr(*ref_t, [&](auto &t) { + return manager->mkfs(t + ).si_then([this, &t] { + return submit_transaction_fut2(t); + }); }); - }); }); + }); }).safe_then([this] { return tm->close(); }).handle_error(