fix: make the default minfreespace safe to change at runtime

- Setting minfreespace through the .mergerfs xattr wrote the shared
  default while request threads read it through each branch, with no
  synchronization. That is a data race; on 32-bit targets a request
  could see half of the new 64-bit value.
- Store the default as std::atomic<u64> and read and write it with
  relaxed loads and stores. Per-branch values are unchanged.
This commit is contained in:
Antonio SJ Musumeci 2026-11-21 14:42:19 -05:00
parent 416af29cc1
commit 4a665bbf32
10 changed files with 61 additions and 30 deletions

View file

@ -21,6 +21,7 @@
#include "base_types.h"
#include "fs_path.hpp"
#include <atomic>
#include <filesystem>
#include <string>
@ -30,6 +31,7 @@ namespace str
std::string to(const bool);
std::string to(const int);
std::string to(cu64);
std::string to(const std::atomic<u64>&);
std::string to(cs64);
std::string to(const std::string&);
std::string to(const fs::path&);