From b444a9f478339e057bf9ac65f7145ba4381a92bf Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Wed, 14 Dec 2022 16:43:47 +0000 Subject: [PATCH] os/bluestore: BlueFS: harmonize log read and writes modes BlueFS log has always been written in non-buffered mode. Reading of it depends on bluefs_buffered_io option. It is strongly suspected that this causes some wierd problems. Possibly fixes: https://tracker.ceph.com/issues/54019 It is targetted directly to pacific. Ultimately same fix will go to all versions. This problem is severe, but happens very infrequently, mostly on contenerized environments. We have a lot of problems in tracker that we suspect are caused by this. To find them, we have "problem-detection" PR #49198 in main. Then we will apply equivalent solution there too. Signed-off-by: Adam Kupczyk --- src/os/bluestore/BlueFS.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 9bf79ead050c5..f462fa886481f 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -2063,12 +2063,15 @@ int64_t BlueFS::_read( << std::hex << x_off << "~" << l << std::dec << " of " << *p << dendl; int r; + // when reading BlueFS log (only happens on startup) use non-buffered io + // it makes it in sync with logic in _flush_range() + bool use_buffered_io = h->file->fnode.ino == 1 ? false : cct->_conf->bluefs_buffered_io; if (!cct->_conf->bluefs_check_for_zeros) { r = bdev[p->bdev]->read(p->offset + x_off, l, &buf->bl, ioc[p->bdev], - cct->_conf->bluefs_buffered_io); + use_buffered_io); } else { r = read(p->bdev, p->offset + x_off, l, &buf->bl, ioc[p->bdev], - cct->_conf->bluefs_buffered_io); + use_buffered_io); } ceph_assert(r == 0); } -- 2.47.3