From 103cd358f2a448e598a31cc7013d9bf8cac2c7bb Mon Sep 17 00:00:00 2001 From: "Antonio S. Musumeci" Date: Sat, 18 Apr 2026 00:45:23 -0400 Subject: [PATCH] state: atomic ref_count in OpenFile ref_count is read and written from multiple FUSE worker threads during open/release. Make it std::atomic and provide a move constructor so OpenFile remains movable when the underlying atomic is non-movable. --- src/state.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/state.hpp b/src/state.hpp index 5f36db48..b7905a51 100644 --- a/src/state.hpp +++ b/src/state.hpp @@ -79,6 +79,7 @@ #include "fuse.h" +#include #include #include #include @@ -102,7 +103,14 @@ public: { } - int ref_count; + OpenFile(OpenFile &&o_) noexcept + : ref_count(o_.ref_count.load()), + backing_id(o_.backing_id), + fi(o_.fi) + { + } + + std::atomic ref_count; int backing_id; FileInfo *fi; };