forked from lix-project/lix
Merge pull request #7521 from ncfavier/migration-deadlock
Release shared lock before acquiring exclusive lock
This commit is contained in:
commit
e8a3e58171
|
@ -91,6 +91,7 @@ void migrateCASchema(SQLite& db, Path schemaPath, AutoCloseFD& lockFd)
|
||||||
|
|
||||||
if (!lockFile(lockFd.get(), ltWrite, false)) {
|
if (!lockFile(lockFd.get(), ltWrite, false)) {
|
||||||
printInfo("waiting for exclusive access to the Nix store for ca drvs...");
|
printInfo("waiting for exclusive access to the Nix store for ca drvs...");
|
||||||
|
lockFile(lockFd.get(), ltNone, false); // We have acquired a shared lock; release it to prevent deadlocks
|
||||||
lockFile(lockFd.get(), ltWrite, true);
|
lockFile(lockFd.get(), ltWrite, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +300,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
|
|
||||||
if (!lockFile(globalLock.get(), ltWrite, false)) {
|
if (!lockFile(globalLock.get(), ltWrite, false)) {
|
||||||
printInfo("waiting for exclusive access to the Nix store...");
|
printInfo("waiting for exclusive access to the Nix store...");
|
||||||
|
lockFile(globalLock.get(), ltNone, false); // We have acquired a shared lock; release it to prevent deadlocks
|
||||||
lockFile(globalLock.get(), ltWrite, true);
|
lockFile(globalLock.get(), ltWrite, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue