]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: invoke _prepare_ondisk_format_super as the last op 34610/head
authorIgor Fedotov <ifedotov@suse.com>
Fri, 17 Apr 2020 16:26:29 +0000 (19:26 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 30 Apr 2020 08:36:32 +0000 (11:36 +0300)
Fixes: https://tracker.ceph.com/issues/45133
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit e792e19331d7cde91b0e8601fd33c41765a10232)

src/os/bluestore/BlueStore.cc

index d6e7bf5fab15e3f274bf366b86f7990ad98ae61a..e5a8dabfc4be53c1ddab87cae9fc06a717a29020 100644 (file)
@@ -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;