From: Adam Kupczyk Date: Tue, 9 Nov 2021 12:01:23 +0000 (+0100) Subject: os/bluestore: Protect _clone against sudden omap format changes X-Git-Tag: v17.1.0~250^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0be2c26a25bf3ca6c5207738f303d77f34e67e70;p=ceph-ci.git os/bluestore: Protect _clone against sudden omap format changes 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 309a3af3c8e..371f92220aa 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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;