mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Fix auto-gc
This commit is contained in:
parent
8614cf1334
commit
ff453b06f9
3 changed files with 19 additions and 5 deletions
|
@ -112,6 +112,9 @@ void LocalStore::addTempRoot(const StorePath & path)
|
|||
|
||||
}
|
||||
|
||||
if (!state->fdGCLock)
|
||||
state->fdGCLock = openGCLock();
|
||||
|
||||
restart:
|
||||
FdLock gcLock(state->fdGCLock.get(), ltRead, false, "");
|
||||
|
||||
|
@ -653,8 +656,11 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
|||
if (state.shouldDelete)
|
||||
deletePath(reservedPath);
|
||||
|
||||
/* Acquire the global GC root. */
|
||||
FdLock gcLock(_state.lock()->fdGCLock.get(), ltWrite, true, "waiting for the big garbage collector lock...");
|
||||
/* Acquire the global GC root. Note: we don't use state->fdGCLock
|
||||
here because then in auto-gc mode, another thread could
|
||||
downgrade our exclusive lock. */
|
||||
auto fdGCLock = openGCLock();
|
||||
FdLock gcLock(fdGCLock.get(), ltWrite, true, "waiting for the big garbage collector lock...");
|
||||
|
||||
/* Start the server for receiving new roots. */
|
||||
auto socketPath = stateDir.get() + gcSocketPath;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue