Use a POSIX lock for pkgdb and only issue pkgdb writes in exact points.

- Rather than using a POSIX named semaphore use a POSIX lock (lockf(3))
for pkgdb for writers. Writers that cannot acquire the pkgdb lock will
get EAGAIN rather then being blocked.

- Due to using a file lock we cannot write the pkgdb every time a package
is being unpacked, configured or removed. Instead pkgdb is only written
at the end of a specific point in the transaction (unpack, configure, remove)
or via xbps_pkgdb_unlock().
This commit is contained in:
Juan RP
2014-03-04 14:37:10 +01:00
parent 6335573180
commit 0416b067d0
11 changed files with 85 additions and 101 deletions

5
NEWS
View File

@@ -8,6 +8,9 @@ xbps-0.33 (???):
the output file will be named "bar.tar.gz". Contributed by
Enno Boland (Gottox).
* Rather than performing a pkgdb write per package being unpacked, configured,
or removed, issue the write only once after the transaction phase has finished.
* While checking file permissions for package files removal, make sure
to not dereference symbolic links, because a symlink might point to
a file in the rootfs, which won't have the same uid/gid.
@@ -20,7 +23,7 @@ xbps-0.33 (???):
* Only allow a single writer to the pkgdb to avoid concurrency issues
when performing multiple write transactions (install, update or remove).
The implementation relies on a POSIX named semaphore.
Processes that cannot acquire the lock will get an EAGAIN error.
* Do not continue the transaction if downloading a binpkg/signature file
has failed for some reason, stop and return error immediately.