From: Adam Kupczyk Date: Wed, 14 Dec 2022 16:43:47 +0000 (+0000) Subject: os/bluestore: BlueFS: harmonize log read and writes modes X-Git-Tag: v16.2.11~39^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F49431%2Fhead;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 9bf79ead050..f462fa88648 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); }