Commit Graph
12 Commits
Author SHA1 Message Date
eldritch horrors 2c00a68624 libutil: explicitly declare and document our reserved signals
Change-Id: Ia27cce0d3577219b7476f7ce6dade4387ba727b2
2025-06-30 21:46:29 +00:00
eldritch horrors 7f95f9a85c libstore: mark blocking file locks as never async
Change-Id: Icf4633b5cd540cb777004c3dce6aa9d79a7f4063
2025-02-16 14:59:32 +00:00
eldritch horrors 6e12f8922c libstore: add async path locking
just single path locks for now since we don't need more.

Change-Id: I0f1be156e762fbe7355dc1381295a7b276bad720
2025-02-08 12:45:15 +00:00
eldritch horrors ec44c8bd6c libstore: rework path locking infra entirely
we now allow for single locked paths rather than only sets, the lock
holder classes are finally resource-safe, and not locking files from
within constructors means we can (in theory!) make path locks async.

Change-Id: I1e1807299d370c07b15c332d5b2ff77b64456e7d
2025-02-08 13:39:49 +01:00
eldritch horrors 72326c4044 libstore: always delete PathLocks lockfiles
they are not being created with O_EXCL and their existence is not
checked for using the PathLocks api, so we will boldy assume that
*nothing* checks for lock file existence. deleting lockfiles when
we're done with them in all cases makes the code cleaner, and any
failing builds no longer litter their store with stale lockfiles.

Change-Id: Iffb588d29b00e6aca32fcb6776980455238ac2bd
2025-02-08 13:14:48 +01:00
eldritch horrors 80189b3c26 libstore: add async FdLock constructor
the local store doesn't have to block the entire thread waiting for a
lock with such support. we'll still block *some* thread, but there is
currently no good way around that without e.g. a lock manager daemon.

Change-Id: I037fdc749e1b56cf9e0f1ca7ac70274442fb2b8c
2025-02-08 08:54:16 +00:00
eldritch horrors 8f5f33c9d8 libstore: bind FdLock to AutoCloseFD and make resource-safe
Change-Id: I2451c15bd0e7d3a5a537bbb65502fd4a18ae0c22
2025-02-08 08:33:26 +00:00
eldritch horrors 3c7162e6d0 libstore: split PathLocks::lockPaths into lock, tryLock
Change-Id: I202cfc077b7e468c74ecd8039175cef34855944c
2025-02-06 14:05:34 +00:00
eldritch horrors d186064c3d libstore: never return from lockFile without a lock
signals could cause lockFile to return without having locked the file.
the garbage collector didn't check for this, and then hilarity ensued.

Change-Id: If86d33595e8bf5510d2b032139342261dc6e07c9
2025-02-03 22:27:47 +00:00
eldritch horrors 79f9c39e36 libstore: split tryLockFile lockFile
lockFile is currently interruptible by signals like SIGCHLD. which
happen a lot in daemons. now imagine that daemon enabled automatic
garbage collection. observe that the local store does not actually
check whether its lock operations have succeeded ... get the idea?

Change-Id: Ibfd7ee786c4fee3add72d4456a7e95e73e09c73e
2025-02-03 21:56:26 +01:00
eldritch horrors aa87c8aa93 libstore: extract unlockFile from lockFile
propagating the "unlock" lock type through this high-level api is
nonsense. it doesn't make sense to treat locking and unlocking as
similar operations; unlocking *must* not not interruptible by our
checkInterrupt machinery or it will just leave locks lying around
for a potentially very long time. unlock operations should not be
taking long enough to *want* them interrupted anyway. even on nfs
this makes very little sense because nfs waits *uninterruptibly*.

Change-Id: I10d605c8fe6c651bee64466eee1f8e20251d39f4
2025-02-03 21:56:26 +01:00
eldritch horrorsandjade b0d7a81613 fix tooling after include reorganization
clangd broke because it can't look through symlinks. compile_commands
manipulation does not fix it, clangd configuration does not fix it, a
vfs overlay does not fix it, and while a combination of those can fix
it with a bind mount in place that's just too cursed to even consider

clangd bug: https://github.com/llvm/llvm-project/issues/116877

Change-Id: I8e3e8489548eb3a7aa65ac9d12a5ec8abf814aec
2024-11-19 22:55:32 +00:00