OPTION(bluestore_debug_permit_any_bdev_label, OPT_BOOL)
OPTION(bluestore_shard_finishers, OPT_BOOL)
OPTION(bluestore_debug_random_read_err, OPT_DOUBLE)
+OPTION(bluestore_debug_inject_bug21040, OPT_BOOL)
OPTION(kstore_max_ops, OPT_U64)
OPTION(kstore_max_bytes, OPT_U64)
uint64_t& length, uint64_t& dstoff) {
auto cct = onode->c->store->cct;
+ bool inject_21040 =
+ cct->_conf->bluestore_debug_inject_bug21040;
vector<BlobRef> id_to_blob(oldo->extent_map.extent_map.size());
for (auto& e : oldo->extent_map.extent_map) {
e.blob->last_encoded_id = -1;
// make sure it is shared
if (!blob.is_shared()) {
c->make_blob_shared(b->_assign_blobid(txc), e.blob);
- if (!src_dirty) {
- src_dirty = true;
+ if (!inject_21040 && !src_dirty) {
+ src_dirty = true;
dirty_range_begin = e.logical_offset;
- }
+ } else if (inject_21040 &&
+ dirty_range_begin == 0 && dirty_range_end == 0) {
+ dirty_range_begin = e.logical_offset;
+ }
assert(e.logical_end() > 0);
// -1 to exclude next potential shard
dirty_range_end = e.logical_end() - 1;
dout(20) << __func__ << " dst " << *ne << dendl;
++n;
}
- if (src_dirty) {
+ if ((!inject_21040 && src_dirty) ||
+ (inject_21040 && dirty_range_end > dirty_range_begin)) {
oldo->extent_map.dirty_range(dirty_range_begin,
dirty_range_end - dirty_range_begin);
txc->write_onode(oldo);
_dump_onode(newo);
oldo->extent_map.dup(this, txc, c, oldo, newo, srcoff, length, dstoff);
-
_dump_onode(oldo);
_dump_onode(newo);
return 0;
int r;
const size_t repeats = 16;
{
+ auto ch = store->create_new_collection(cid);
cerr << "create collection + write" << std::endl;
ObjectStore::Transaction t;
t.create_collection(cid, 0);
ASSERT_EQ(bstore->fsck(true), 0);
+ // reproducing issues #21040 & 20983
+ g_ceph_context->_conf->set_val(
+ "bluestore_debug_inject_bug21040", "true");
+ g_ceph_context->_conf->apply_changes(NULL);
+ bstore->mount();
+
+ cerr << "repro bug #21040" << std::endl;
+ {
+ auto ch = store->open_collection(cid);
+ {
+ ObjectStore::Transaction t;
+ bl.append("0123456789012345");
+ t.write(cid, hoid3, offs_base, bl.length(), bl);
+ bl.clear();
+ bl.append('!');
+ t.write(cid, hoid3, 0, bl.length(), bl);
+
+ r = queue_transaction(store, ch, std::move(t));
+ ASSERT_EQ(r, 0);
+ }
+ {
+ ObjectStore::Transaction t;
+ t.clone(cid, hoid3, hoid3_cloned);
+ r = queue_transaction(store, ch, std::move(t));
+ ASSERT_EQ(r, 0);
+ }
+
+ bstore->umount();
+ ASSERT_EQ(bstore->fsck(false), 3);
+ ASSERT_LE(bstore->repair(false), 0);
+ ASSERT_EQ(bstore->fsck(false), 0);
+ g_ceph_context->_conf->set_val(
+ "bluestore_debug_inject_bug21040", "true");
+ g_ceph_context->_conf->apply_changes(NULL);
+ }
+
+
cerr << "Completing" << std::endl;
bstore->mount();
g_ceph_context->_conf->set_val("bluestore_fsck_on_mount", "true");