1 Star 0 Fork 78

xiexing/ceph

forked from src-openEuler/ceph 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0007-bluestore-use-direct-write-for-bdevlabel.patch 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
From 7672ceb4f09c81ee7a2d5e8672e2c402c3206b4e Mon Sep 17 00:00:00 2001
From: luo rixin <luorixin@huawei.com>
Date: Wed, 14 Sep 2022 19:50:01 +0800
Subject: [PATCH] os/bluestore: use direct write in
BlueStore::_write_bdev_label
On AArch64 with kernel page size 64K, it occurs occasionally
"OSD::init(): unable to read osd superblock" when deploying osd.
As bluestore use direct write to write the superblock at 0x2000~1000
and BlueStore::_write_bdev_label use buffer write to write label at
0x0~1000, The OS flush the buffer write algined to page size, it will
overwrite the superblock(0x2000~1000). Use driect write to avoid
overwriting the superblock.
Fixes: https://tracker.ceph.com/issues/57537
Signed-off-by: luo rixin <luorixin@huawei.com>
---
src/os/bluestore/BlueStore.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc
index 8b893be79d1..534fe780f27 100644
--- a/src/os/bluestore/BlueStore.cc
+++ b/src/os/bluestore/BlueStore.cc
@@ -5104,13 +5104,14 @@ int BlueStore::_write_bdev_label(CephContext *cct,
z.zero();
bl.append(std::move(z));
- int fd = TEMP_FAILURE_RETRY(::open(path.c_str(), O_WRONLY|O_CLOEXEC));
+ int fd = TEMP_FAILURE_RETRY(::open(path.c_str(), O_WRONLY|O_CLOEXEC|O_DIRECT));
if (fd < 0) {
fd = -errno;
derr << __func__ << " failed to open " << path << ": " << cpp_strerror(fd)
<< dendl;
return fd;
}
+ bl.rebuild_aligned_size_and_memory(BDEV_LABEL_BLOCK_SIZE, BDEV_LABEL_BLOCK_SIZE, IOV_MAX);
int r = bl.write_fd(fd);
if (r < 0) {
derr << __func__ << " failed to write to " << path
--
2.20.1.windows.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiexing01/ceph.git
git@gitee.com:xiexing01/ceph.git
xiexing01
ceph
ceph
master

搜索帮助