This stuff has been solved ages ago on Unix.
There may be simplifications to this, but I suspect it eventually lands in a distributed system problem involving state and strong consistency semantics. I’ve done this for most of my engineering career and all I can say is that they are fun problems to work on because they are some of the most difficult ones :)