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 de2dad1a88
commit fd225b999c
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 <string>
#include <string_view>
@ -30,6 +31,7 @@ namespace str
int from(const std::string_view, bool *);
int from(const std::string_view, int *);
int from(const std::string_view, u64 *);
int from(const std::string_view, std::atomic<u64> *);
int from(const std::string_view, s64 *);
int from(const std::string_view, std::string *);
int from(const std::string_view, const std::string *);