forked from lix-project/lix
Remove UserLock self-lock check
This is no longer needed since we're not using POSIX locks anymore.
This commit is contained in:
parent
3b9c9d34e5
commit
61cc9f34d2
|
@ -499,12 +499,6 @@ void handleDiffHook(uid_t uid, uid_t gid, Path tryA, Path tryB, Path drvPath, Pa
|
||||||
class UserLock
|
class UserLock
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/* POSIX locks suck. If we have a lock on a file, and we open and
|
|
||||||
close that file again (without closing the original file
|
|
||||||
descriptor), we lose the lock. So we have to be *very* careful
|
|
||||||
not to open a lock file on which we are holding a lock. */
|
|
||||||
static Sync<PathSet> lockedPaths_;
|
|
||||||
|
|
||||||
Path fnUserLock;
|
Path fnUserLock;
|
||||||
AutoCloseFD fdUserLock;
|
AutoCloseFD fdUserLock;
|
||||||
|
|
||||||
|
@ -515,7 +509,6 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UserLock();
|
UserLock();
|
||||||
~UserLock();
|
|
||||||
|
|
||||||
void kill();
|
void kill();
|
||||||
|
|
||||||
|
@ -529,9 +522,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Sync<PathSet> UserLock::lockedPaths_;
|
|
||||||
|
|
||||||
|
|
||||||
UserLock::UserLock()
|
UserLock::UserLock()
|
||||||
{
|
{
|
||||||
assert(settings.buildUsersGroup != "");
|
assert(settings.buildUsersGroup != "");
|
||||||
|
@ -568,15 +558,6 @@ UserLock::UserLock()
|
||||||
|
|
||||||
fnUserLock = (format("%1%/userpool/%2%") % settings.nixStateDir % pw->pw_uid).str();
|
fnUserLock = (format("%1%/userpool/%2%") % settings.nixStateDir % pw->pw_uid).str();
|
||||||
|
|
||||||
{
|
|
||||||
auto lockedPaths(lockedPaths_.lock());
|
|
||||||
if (!lockedPaths->insert(fnUserLock).second)
|
|
||||||
/* We already have a lock on this one. */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
AutoCloseFD fd = open(fnUserLock.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0600);
|
AutoCloseFD fd = open(fnUserLock.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0600);
|
||||||
if (!fd)
|
if (!fd)
|
||||||
throw SysError(format("opening user lock '%1%'") % fnUserLock);
|
throw SysError(format("opening user lock '%1%'") % fnUserLock);
|
||||||
|
@ -606,10 +587,6 @@ UserLock::UserLock()
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (...) {
|
|
||||||
lockedPaths_.lock()->erase(fnUserLock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Error(format("all build users are currently in use; "
|
throw Error(format("all build users are currently in use; "
|
||||||
|
@ -618,14 +595,6 @@ UserLock::UserLock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UserLock::~UserLock()
|
|
||||||
{
|
|
||||||
auto lockedPaths(lockedPaths_.lock());
|
|
||||||
auto erased = lockedPaths->erase(fnUserLock);
|
|
||||||
assert(erased);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UserLock::kill()
|
void UserLock::kill()
|
||||||
{
|
{
|
||||||
killUser(uid);
|
killUser(uid);
|
||||||
|
|
Loading…
Reference in a new issue