From 2215c8155d405524ee29df0e75ff57b319d38c2b Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Fri, 17 Dec 2021 13:20:35 +0800 Subject: [PATCH] crimson/os/seastore: reset onode in 'SeaStore::repeat_with_onode' before the transaction gets destroyed Onodes hold references to the onode tree extents. And if it's referencing the root extent, that root extent is cached in the onode trees root_tracker which caches onode tree roots by transaction address. Than root_tracker entry only gets removed when the onode(or the corresponding "super") is destroyed. On the other hand, two non-concurrent transactions can occupy the same address. So if an onode gets destroyed after its transaction is destroyed, there will be a chance that another transaction occupying the same address get that not-yet-destroyed and may-be-outdated onode. BTW, Since we already cache extents in transactions, might want to drop onode tree root_tracker later? Fixes: https://tracker.ceph.com/issues/53651 Signed-off-by: Xuehan Xu --- src/crimson/os/seastore/seastore.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index 4e3929ba690a6..d5a79a3fdb84c 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -254,7 +254,8 @@ private: ).si_then([&](auto onode_ret) { onode = std::move(onode_ret); return f(t, *onode); - }).si_then([&ret](auto _ret) { + }).si_then([&ret, &onode](auto _ret) { + onode.reset(); ret = _ret; }); }); -- 2.39.5