From: Igor Fedotov Date: Fri, 11 Oct 2019 14:15:22 +0000 (+0300) Subject: os/bluestore: don't do init_rm_free when mounting bluefs after mkfs. X-Git-Tag: wip-pdonnell-testing-20200918.022351~473^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=48427ff633ce56ce69f367e130ac94172e873315;p=ceph-ci.git os/bluestore: don't do init_rm_free when mounting bluefs after mkfs. This is a duplicate op which might cause allocator (namely stupid one) to fail. Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 4cd260b8119..9a3175b3241 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -584,6 +584,8 @@ int BlueFS::mkfs(uuid_d osd_uuid, const bluefs_layout_t& layout) _stop_alloc(); _shutdown_logger(); + after_mkfs = true; + dout(10) << __func__ << " success" << dendl; return 0; } @@ -650,10 +652,6 @@ void BlueFS::_stop_alloc() p->discard_drain(); } - for (auto p : alloc) { - if (p != nullptr && p != shared_bdev_alloc) { - } - } for (size_t i = 0; i < alloc.size(); ++i) { if (alloc[i] && alloc[i] != shared_bdev_alloc) { alloc[i]->shutdown(); @@ -699,9 +697,13 @@ int BlueFS::mount() for (auto& p : file_map) { dout(30) << __func__ << " noting alloc for " << p.second->fnode << dendl; for (auto& q : p.second->fnode.extents) { - alloc[q.bdev]->init_rm_free(q.offset, q.length); if (alloc[q.bdev] == shared_bdev_alloc) { + if (!after_mkfs) { + alloc[q.bdev]->init_rm_free(q.offset, q.length); + } shared_bdev_used += q.length; + } else { + alloc[q.bdev]->init_rm_free(q.offset, q.length); } } } @@ -715,6 +717,8 @@ int BlueFS::mount() << std::hex << log_writer->pos << std::dec << dendl; + after_mkfs = false; + return 0; out: diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 0a2fe38c5b0..edbdd94e889 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -315,6 +315,8 @@ private: class SocketHook; SocketHook* asok_hook = nullptr; + bool after_mkfs = false; + void _init_logger(); void _shutdown_logger(); void _update_logger_stats();