Skip to content

Commit

Permalink
Merge pull request ceph#53732 from pereman2/bluefs-expand-bug
Browse files Browse the repository at this point in the history
os/bluestore: fix bluefs _extend_log seq update
  • Loading branch information
aclamk authored Oct 13, 2023
2 parents 26f89fc + 63f0a0d commit 9b8e8d9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/os/bluestore/BlueFS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3120,12 +3120,13 @@ void BlueFS::_extend_log(uint64_t amount) {
_pad_bl(bl, super.block_size);
log.writer->append(bl);
ceph_assert(allocated_before_extension >= log.writer->get_effective_write_pos());
log.t.seq = log.seq_live;

// before sync_core we advance the seq
{
std::unique_lock<ceph::mutex> l(dirty.lock);
_log_advance_seq();
dirty.seq_live++;
log.seq_live++;
log.t.seq++;
}
}

Expand Down
24 changes: 24 additions & 0 deletions src/test/objectstore/test_bluefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,30 @@ TEST(BlueFS, test_log_runway_3) {
}
}

TEST(BlueFS, test_log_runway_advance_seq) {
uint64_t max_log_runway = 65536;
ConfSaver conf(g_ceph_context->_conf);
conf.SetVal("bluefs_alloc_size", "4096");
conf.SetVal("bluefs_shared_alloc_size", "4096");
conf.SetVal("bluefs_compact_log_sync", "false");
conf.SetVal("bluefs_min_log_runway", "32768");
conf.SetVal("bluefs_max_log_runway", std::to_string(max_log_runway).c_str());
conf.ApplyChanges();

uint64_t size = 1048576 * 128;
TempBdev bdev{size};
BlueFS fs(g_ceph_context);
ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, bdev.path, false));
uuid_d fsid;
ASSERT_EQ(0, fs.mkfs(fsid, { BlueFS::BDEV_DB, false, false }));
ASSERT_EQ(0, fs.mount());
ASSERT_EQ(0, fs.maybe_verify_layout({ BlueFS::BDEV_DB, false, false }));

std::string longdir(max_log_runway*2, 'A');
ASSERT_EQ(fs.mkdir(longdir), 0);
fs.compact_log();
}

int main(int argc, char **argv) {
auto args = argv_to_vec(argc, argv);
map<string,string> defaults = {
Expand Down

0 comments on commit 9b8e8d9

Please sign in to comment.