]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
os/bluestore: pin onodes as they are added to the cache
authorJosh Durgin <jdurgin@redhat.com>
Thu, 21 Nov 2019 04:50:38 +0000 (23:50 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Thu, 21 Nov 2019 05:00:47 +0000 (00:00 -0500)
commit57acecb27c4a12d67010f6681a518c25a72c00a8
tree56b5448e2cce75f87b2158e34aee8f2618b3865d
parent0808184b0f4f7e1596ddf7200c0847c76b86e86d
os/bluestore: pin onodes as they are added to the cache

When onodes are added to the cache, they may have more than one
reference already. Due to the implicit nature of boost::intrusive, in
the common case of creating a new Onode, they have 3 references at
this point.

Since they haven't been added to the cache yet, Onode::get() could not
pin them when they went from 1->2 references. Instead, take care of it
when they do get added to the cache. The pinning in get() is still
needed in case they get unpinned and then referenced again while still
cached.

This lack of pinning meant that newly created onodes were immediately
removed from the cache, since the last step of adding a new onode is
trimming the cache. In tests that read the object just after queueing
a write to it, the read got ENOENT, when it should have read the onode
from cache.

Fixes: https://tracker.ceph.com/issues/42495
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/os/bluestore/BlueStore.cc