mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-02 04:46:41 -05:00
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:
parent
de2dad1a88
commit
fd225b999c
10 changed files with 61 additions and 30 deletions
|
|
@ -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 *);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue