Skip to content

Commit 627b134

Browse files
authored
Merge pull request ceph#63761 from aclamk/aclamk-bs-bluefs-various-fixes
os/bluestore: Set of various fixes to bluefs Reviewed-by: Igor Fedotov <[email protected]>
2 parents 1381a89 + d9d7e73 commit 627b134

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

src/os/bluestore/BlueFS.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4695,7 +4695,6 @@ void BlueFS::_drain_writer(FileWriter *h)
46954695
if (bdev[i]) {
46964696
if (h->iocv[i]) {
46974697
h->iocv[i]->aio_wait();
4698-
delete h->iocv[i];
46994698
}
47004699
}
47014700
}

src/os/bluestore/BlueFS.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ class BlueFS {
434434
// NOTE: caller must call BlueFS::close_writer()
435435
~FileWriter() {
436436
--file->num_writers;
437+
for (unsigned i = 0; i < MAX_BDEV; ++i) {
438+
delete iocv[i];
439+
}
437440
}
438441

439442
// note: BlueRocksEnv uses this append exclusively, so it's safe

src/os/bluestore/bluefs_types.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,6 @@ void bluefs_super_t::encode(bufferlist& bl) const
190190
encode(block_size, bl);
191191
encode(log_fnode, bl);
192192
encode(memorized_layout, bl);
193-
if (_version >= 3) {
194-
encode(wal_version, bl);
195-
}
196193
ENCODE_FINISH(bl);
197194
}
198195

@@ -208,9 +205,6 @@ void bluefs_super_t::decode(bufferlist::const_iterator& p)
208205
if (struct_v >= 2) {
209206
decode(memorized_layout, p);
210207
}
211-
if (struct_v >= 3) {
212-
decode(wal_version, p);
213-
}
214208
DECODE_FINISH(p);
215209
}
216210

src/os/bluestore/bluefs_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ struct bluefs_super_t {
328328

329329
std::optional<bluefs_layout_t> memorized_layout;
330330

331-
uint8_t wal_version;
332-
333331
bluefs_super_t();
334332

335333
uint64_t block_mask() const {

src/test/objectstore/test_bluefs.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ TEST(BlueFS, test_wal_migrate) {
11371137
gen_debugable(70000, bl1);
11381138
fs.append_try_flush(writer, bl1.c_str(), bl1.length());
11391139
fs.fsync(writer);
1140-
1140+
fs.close_writer(writer);
11411141
// WAL files don't update internal extents while writing to save memory, only on _replay
11421142
fs.umount();
11431143
fs.mount();
@@ -1435,6 +1435,7 @@ TEST(BlueFS, test_wal_read_after_rollback_to_v1) {
14351435
gen_debugable(70000, bl1);
14361436
fs.append_try_flush(writer, bl1.c_str(), bl1.length());
14371437
fs.fsync(writer);
1438+
fs.close_writer(writer);
14381439

14391440
g_ceph_context->_conf.set_val("bluefs_wal_envelope_mode", "false");
14401441
fs.umount();
@@ -1454,6 +1455,7 @@ TEST(BlueFS, test_wal_read_after_rollback_to_v1) {
14541455
ASSERT_EQ(0, fs.open_for_write(dir_db, wal_file, &writer, false));
14551456
ASSERT_NE(nullptr, writer);
14561457
ASSERT_EQ(writer->file->fnode.encoding, bluefs_node_encoding::PLAIN);
1458+
fs.close_writer(writer);
14571459
}
14581460
fs.umount();
14591461
}
@@ -1671,6 +1673,7 @@ TEST(BlueFS, truncate_fsync) {
16711673
fs.fsync(h);
16721674
fs.close_writer(h);
16731675
}
1676+
fs.umount();
16741677
}
16751678
{
16761679
//this was broken due to https://tracker.ceph.com/issues/55307
@@ -1703,7 +1706,7 @@ TEST(BlueFS, test_shared_alloc) {
17031706
size, shared_alloc_unit, "test shared allocator"),
17041707
shared_alloc_unit);
17051708
shared_alloc.a->init_add_free(0, size);
1706-
1709+
auto sg = make_scope_guard([&shared_alloc] { delete shared_alloc.a; });
17071710
BlueFS fs(g_ceph_context);
17081711
// DB device is fully utilized
17091712
ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, bdev_db.path, false));
@@ -1787,6 +1790,7 @@ TEST(BlueFS, test_shared_alloc_sparse) {
17871790
for(uint64_t i = 5 * bluefs_alloc_unit; i < size; i += 2 * main_unit) {
17881791
shared_alloc.a->init_add_free(i, main_unit);
17891792
}
1793+
auto sg = make_scope_guard([&shared_alloc] { delete shared_alloc.a; });
17901794

17911795
BlueFS fs(g_ceph_context);
17921796
ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, bdev_slow.path, false,
@@ -1863,6 +1867,7 @@ TEST(BlueFS, test_4k_shared_alloc) {
18631867
size, main_unit, "test shared allocator"),
18641868
main_unit);
18651869
shared_alloc.a->init_add_free(bluefs_alloc_unit, size - bluefs_alloc_unit);
1870+
auto sg = make_scope_guard([&shared_alloc] { delete shared_alloc.a; });
18661871

18671872
BlueFS fs(g_ceph_context);
18681873
ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, bdev_slow.path, false,
@@ -2125,6 +2130,7 @@ TEST(BlueFS, test_log_runway) {
21252130
utime_t mtime;
21262131
fs.stat("dir", "file", &file_size, &mtime);
21272132
ASSERT_EQ(file_size, 9);
2133+
fs.umount();
21282134
}
21292135

21302136
TEST(BlueFS, test_log_runway_2) {
@@ -2182,6 +2188,7 @@ TEST(BlueFS, test_log_runway_2) {
21822188
std::vector<std::string> ls_longdir;
21832189
fs.readdir(longdir, &ls_longdir);
21842190
ASSERT_EQ(ls_longdir.front(), longfile);
2191+
fs.umount();
21852192
}
21862193

21872194
TEST(BlueFS, test_log_runway_3) {
@@ -2242,6 +2249,7 @@ TEST(BlueFS, test_log_runway_3) {
22422249
fs.stat(longdir, longfile, &file_size, &mtime);
22432250
ASSERT_EQ(file_size, 6);
22442251
}
2252+
fs.umount();
22452253
}
22462254

22472255
TEST(BlueFS, test_log_runway_advance_seq) {
@@ -2266,6 +2274,7 @@ TEST(BlueFS, test_log_runway_advance_seq) {
22662274
std::string longdir(max_log_runway*2, 'A');
22672275
ASSERT_EQ(fs.mkdir(longdir), 0);
22682276
fs.compact_log();
2277+
fs.umount();
22692278
}
22702279

22712280
TEST(BlueFS, test_69481_truncate_corrupts_log) {

0 commit comments

Comments
 (0)