]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Protect _clone against sudden omap format changes 43857/head
authorAdam Kupczyk <akupczyk@redhat.com>
Tue, 9 Nov 2021 12:01:23 +0000 (13:01 +0100)
committerAdam Kupczyk <akupczyk@redhat.com>
Tue, 9 Nov 2021 12:01:23 +0000 (13:01 +0100)
Added assert to verify that omap prefixes between cloned objects are exactly the same.
If they would differ rewrite_omap_key() will possibly overwrite user key potion of data,
or move some part of prefix into user key.

This is a follow up from
https://github.com/ceph/ceph/pull/43687

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
src/os/bluestore/BlueStore.cc

index 309a3af3c8e8530e37e23dd10d90387dc6491cbb..371f92220aae28a726440fb68076228797b4492f 100644 (file)
@@ -16150,6 +16150,9 @@ int BlueStore::_clone(TransContext *txc,
     } else {
       newo->onode.set_omap_flags(per_pool_omap == OMAP_BULK);
     }
+    // check if prefix for omap key is exactly the same size for both objects
+    // otherwise rewrite_omap_key will corrupt data
+    ceph_assert(oldo->onode.flags == newo->onode.flags);
     const string& prefix = newo->get_omap_prefix();
     KeyValueDB::Iterator it = db->get_iterator(prefix);
     string head, tail;