Skip to content

Commit f8b1495

Browse files
committed
os/bluestore: Fix CBT bluefs-bdev-expand
There was a problem when expansion of 'block' device crossed location of bdev label copy. The extra label that did not exist before and now exist was not initialized. Also changed logic of 'bluestore_bdev_label_require_all'. Previously label locations 0..bdev->size() were taken in to account. Now labels in range bdev_label.size..bdev->size() are excluded. Fixes: https://tracker.ceph.com/issues/68577 Signed-off-by: Adam Kupczyk <[email protected]>
1 parent ebd3d45 commit f8b1495

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6912,8 +6912,19 @@ int BlueStore::_check_main_bdev_label()
69126912
return -EIO;
69136913
}
69146914
if (bluestore_bdev_label_require_all && r != 0) {
6915-
derr << __func__ << " not all labels read properly" << dendl;
6916-
return -EIO;
6915+
// We are about to complain that some labels failed.
6916+
// But in case if we expanded block device some labels will not be good.
6917+
uint64_t lsize = std::max(BDEV_LABEL_BLOCK_SIZE, min_alloc_size);
6918+
uint32_t valid_locations = 0;
6919+
for (uint64_t loc : bdev_label_positions) {
6920+
if (loc + lsize <= bdev_label.size) {
6921+
++valid_locations;
6922+
}
6923+
}
6924+
if (valid_locations != bdev_label_valid_locations.size()) {
6925+
derr << __func__ << " not all labels read properly" << dendl;
6926+
return -EIO;
6927+
}
69176928
}
69186929
return 0;
69196930
}
@@ -8949,11 +8960,25 @@ int BlueStore::expand_devices(ostream& out)
89498960
_close_db_and_around();
89508961

89518962
// mount in read/write to sync expansion changes
8963+
if (bdev_label_multi) {
8964+
// We need not do fsck, because we can be broken - size is increased,
8965+
// but we might not have labels set.
8966+
cct->_conf.set_val_or_die("bluestore_fsck_on_mount", "false");
8967+
}
89528968
r = _mount();
89538969
ceph_assert(r == 0);
89548970
if (fm && fm->is_null_manager()) {
89558971
// we grow the allocation range, must reflect it in the allocation file
89568972
alloc->init_add_free(size0, size - size0);
8973+
if (bdev_label_multi) {
8974+
uint64_t lsize = std::max(BDEV_LABEL_BLOCK_SIZE, min_alloc_size);
8975+
for (uint64_t loc : bdev_label_positions) {
8976+
if ((loc >= size0) && (loc + lsize <= size)) {
8977+
bdev_label_valid_locations.push_back(loc);
8978+
}
8979+
}
8980+
_write_bdev_label(cct, bdev, path + "/block", bdev_label, bdev_label_valid_locations);
8981+
}
89578982
need_to_destage_allocation_file = true;
89588983
}
89598984
umount();

0 commit comments

Comments
 (0)