From d7413341119d9b8eabba8c11b60c0312cd1d5002 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 14 Oct 2021 14:51:38 -0700 Subject: [PATCH] crimson/os/seastore/segment_manager/block: open with dsync 67efc4 appears to be simply incorrect, I don't see any calls to flush(), so we do need to open with dsync until we implement a smarter flushing scheme. Also, refactor open_device to remove mode param -- we always pass the same value. Reverts: 67efc48332cebb69497c5676be6ed2a6e5365e03 Signed-off-by: Samuel Just --- src/crimson/os/seastore/segment_manager/block.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/crimson/os/seastore/segment_manager/block.cc b/src/crimson/os/seastore/segment_manager/block.cc index 5b395fac589b6..907b089897669 100644 --- a/src/crimson/os/seastore/segment_manager/block.cc +++ b/src/crimson/os/seastore/segment_manager/block.cc @@ -245,12 +245,14 @@ using open_device_ret = >; static open_device_ret open_device( - const std::string &path, - seastar::open_flags mode) + const std::string &path) { return seastar::file_stat(path, seastar::follow_symlink::yes - ).then([mode, &path](auto stat) mutable { - return seastar::open_file_dma(path, mode).then([=](auto file) { + ).then([&path](auto stat) mutable { + return seastar::open_file_dma( + path, + seastar::open_flags::rw | seastar::open_flags::dsync + ).then([=](auto file) { logger().error( "open_device: open successful, size {}", stat.size @@ -389,7 +391,7 @@ BlockSegmentManager::~BlockSegmentManager() BlockSegmentManager::mount_ret BlockSegmentManager::mount() { return open_device( - device_path, seastar::open_flags::rw + device_path ).safe_then([=](auto p) { device = std::move(p.first); auto sd = p.second; @@ -440,7 +442,7 @@ BlockSegmentManager::mkfs_ret BlockSegmentManager::mkfs( } return maybe_create.safe_then([this] { - return open_device(device_path, seastar::open_flags::rw); + return open_device(device_path); }).safe_then([&, sm_config](auto p) { device = p.first; stat = p.second; -- 2.39.5