Skip to content

Commit 9b8e8d9

Browse files
authored
Merge pull request ceph#53732 from pereman2/bluefs-expand-bug
os/bluestore: fix bluefs _extend_log seq update
2 parents 26f89fc + 63f0a0d commit 9b8e8d9

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/os/bluestore/BlueFS.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,12 +3120,13 @@ void BlueFS::_extend_log(uint64_t amount) {
31203120
_pad_bl(bl, super.block_size);
31213121
log.writer->append(bl);
31223122
ceph_assert(allocated_before_extension >= log.writer->get_effective_write_pos());
3123-
log.t.seq = log.seq_live;
31243123

31253124
// before sync_core we advance the seq
31263125
{
31273126
std::unique_lock<ceph::mutex> l(dirty.lock);
3128-
_log_advance_seq();
3127+
dirty.seq_live++;
3128+
log.seq_live++;
3129+
log.t.seq++;
31293130
}
31303131
}
31313132

src/test/objectstore/test_bluefs.cc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,30 @@ TEST(BlueFS, test_log_runway_3) {
15591559
}
15601560
}
15611561

1562+
TEST(BlueFS, test_log_runway_advance_seq) {
1563+
uint64_t max_log_runway = 65536;
1564+
ConfSaver conf(g_ceph_context->_conf);
1565+
conf.SetVal("bluefs_alloc_size", "4096");
1566+
conf.SetVal("bluefs_shared_alloc_size", "4096");
1567+
conf.SetVal("bluefs_compact_log_sync", "false");
1568+
conf.SetVal("bluefs_min_log_runway", "32768");
1569+
conf.SetVal("bluefs_max_log_runway", std::to_string(max_log_runway).c_str());
1570+
conf.ApplyChanges();
1571+
1572+
uint64_t size = 1048576 * 128;
1573+
TempBdev bdev{size};
1574+
BlueFS fs(g_ceph_context);
1575+
ASSERT_EQ(0, fs.add_block_device(BlueFS::BDEV_DB, bdev.path, false));
1576+
uuid_d fsid;
1577+
ASSERT_EQ(0, fs.mkfs(fsid, { BlueFS::BDEV_DB, false, false }));
1578+
ASSERT_EQ(0, fs.mount());
1579+
ASSERT_EQ(0, fs.maybe_verify_layout({ BlueFS::BDEV_DB, false, false }));
1580+
1581+
std::string longdir(max_log_runway*2, 'A');
1582+
ASSERT_EQ(fs.mkdir(longdir), 0);
1583+
fs.compact_log();
1584+
}
1585+
15621586
int main(int argc, char **argv) {
15631587
auto args = argv_to_vec(argc, argv);
15641588
map<string,string> defaults = {

0 commit comments

Comments
 (0)