From 67371724d28dd8a27689eabd388121d5c8ae9128 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Fri, 17 Apr 2020 19:26:29 +0300 Subject: [PATCH] os/bluestore: invoke _prepare_ondisk_format_super as the last op Fixes: https://tracker.ceph.com/issues/45133 Signed-off-by: Igor Fedotov (cherry picked from commit e792e19331d7cde91b0e8601fd33c41765a10232) --- src/os/bluestore/BlueStore.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d6e7bf5fab15..e5a8dabfc4be 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -11032,6 +11032,7 @@ int BlueStore::_upgrade_super() ceph_assert(ondisk_format > 0); ceph_assert(ondisk_format < latest_ondisk_format); + KeyValueDB::Transaction t = db->get_transaction(); if (ondisk_format == 1) { // changes: // - super: added ondisk_format @@ -11039,7 +11040,6 @@ int BlueStore::_upgrade_super() // - super: added min_compat_ondisk_format // - super: added min_alloc_size // - super: removed min_min_alloc_size - KeyValueDB::Transaction t = db->get_transaction(); { bufferlist bl; db->get(PREFIX_SUPER, "min_min_alloc_size", &bl); @@ -11056,9 +11056,6 @@ int BlueStore::_upgrade_super() t->rmkey(PREFIX_SUPER, "min_min_alloc_size"); } ondisk_format = 2; - _prepare_ondisk_format_super(t); - int r = db->submit_transaction_sync(t); - ceph_assert(r == 0); } if (ondisk_format == 2) { // changes: @@ -11068,19 +11065,18 @@ int BlueStore::_upgrade_super() // - super: added per_pool_omap key, which indicates that *all* objects // are using the new prefix and key format ondisk_format = 3; - KeyValueDB::Transaction t = db->get_transaction(); - _prepare_ondisk_format_super(t); - int r = db->submit_transaction_sync(t); - ceph_assert(r == 0); } if (ondisk_format == 3) { // changes: // - FreelistManager keeps meta within bdev label int r = _write_out_fm_meta(0); ceph_assert(r == 0); - ondisk_format = 4; } + // This to be the last operation + _prepare_ondisk_format_super(t); + int r = db->submit_transaction_sync(t); + ceph_assert(r == 0); } // done dout(1) << __func__ << " done" << dendl; -- 2.47.3