@@ -6930,8 +6930,19 @@ int BlueStore::_check_main_bdev_label()
69306930 return -EIO;
69316931 }
69326932 if (bluestore_bdev_label_require_all && r != 0) {
6933- derr << __func__ << " not all labels read properly" << dendl;
6934- return -EIO;
6933+ // We are about to complain that some labels failed.
6934+ // But in case if we expanded block device some labels will not be good.
6935+ uint64_t lsize = std::max(BDEV_LABEL_BLOCK_SIZE, min_alloc_size);
6936+ uint32_t valid_locations = 0;
6937+ for (uint64_t loc : bdev_label_positions) {
6938+ if (loc + lsize <= bdev_label.size) {
6939+ ++valid_locations;
6940+ }
6941+ }
6942+ if (valid_locations != bdev_label_valid_locations.size()) {
6943+ derr << __func__ << " not all labels read properly" << dendl;
6944+ return -EIO;
6945+ }
69356946 }
69366947 return 0;
69376948}
@@ -8967,11 +8978,25 @@ int BlueStore::expand_devices(ostream& out)
89678978 _close_db_and_around();
89688979
89698980 // mount in read/write to sync expansion changes
8981+ if (bdev_label_multi) {
8982+ // We need not do fsck, because we can be broken - size is increased,
8983+ // but we might not have labels set.
8984+ cct->_conf.set_val_or_die("bluestore_fsck_on_mount", "false");
8985+ }
89708986 r = _mount();
89718987 ceph_assert(r == 0);
89728988 if (fm && fm->is_null_manager()) {
89738989 // we grow the allocation range, must reflect it in the allocation file
89748990 alloc->init_add_free(size0, size - size0);
8991+ if (bdev_label_multi) {
8992+ uint64_t lsize = std::max(BDEV_LABEL_BLOCK_SIZE, min_alloc_size);
8993+ for (uint64_t loc : bdev_label_positions) {
8994+ if ((loc >= size0) && (loc + lsize <= size)) {
8995+ bdev_label_valid_locations.push_back(loc);
8996+ }
8997+ }
8998+ _write_bdev_label(cct, bdev, path + "/block", bdev_label, bdev_label_valid_locations);
8999+ }
89759000 need_to_destage_allocation_file = true;
89769001 }
89779002 umount();
0 commit comments