]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: BlueFS: harmonize log read and writes modes 49431/head
authorAdam Kupczyk <akupczyk@redhat.com>
Wed, 14 Dec 2022 16:43:47 +0000 (16:43 +0000)
committerAdam Kupczyk <akupczyk@redhat.com>
Wed, 14 Dec 2022 16:55:49 +0000 (16:55 +0000)
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 <akupczyk@redhat.com>
src/os/bluestore/BlueFS.cc

index 9bf79ead050c5cfb6637819a62cae6666b5fab35..f462fa886481fb91340bc5ac16958330b9702e92 100644 (file)
@@ -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);
       }