summaryrefslogtreecommitdiffstats
path: root/src/os
diff options
context:
space:
mode:
authorAdam Kupczyk <akupczyk@redhat.com>2021-11-09 13:01:23 +0100
committerAdam Kupczyk <akupczyk@redhat.com>2021-11-09 13:01:23 +0100
commit0be2c26a25bf3ca6c5207738f303d77f34e67e70 (patch)
treee8b317fcc8bcbb31c8c435575f05e9db147205c4 /src/os
parentMerge pull request #43835 from xxhdx1985126/wip-segment-avail-bytes (diff)
downloadceph-0be2c26a25bf3ca6c5207738f303d77f34e67e70.tar.xz
ceph-0be2c26a25bf3ca6c5207738f303d77f34e67e70.zip
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 <akupczyk@redhat.com>
Diffstat (limited to 'src/os')
-rw-r--r--src/os/bluestore/BlueStore.cc3
1 files changed, 3 insertions, 0 deletions
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;