Greetings,
The following webrev contains fixes for the following issue:
1668 image locking needed to prevent race conditions
webrev:
http://cr.opensolaris.org/~swalker/pkg-lock/
Overview
--------
This implements image locking for all image-modifying operations
excluding those that simply retrieve manifest data (such as info, list,
etc.). This includes the download phase as modifying the image during
that phase would invalidate the plan that will be executed after the
download phase is complete.
Locking Logic
-------------
The current lock algorithm is basically this:
* acquire a non-rentrant lock, waiting up to the timeout seconds
specified for it to be available
* open a lock file for appending and reading ($IMGDIR/lock)
* attempt to obtain an exclusive lock on the file using lockf, waiting
up to the remaining timeout seconds specified for it to be available
* if all above is successful, the current pid and client name will be
written into the lock file
* if any of the above fails, an ImageLockedError (ApiException) is raised
For example, running a pkg refresh --full in two separate terminal
windows results in one failing with this message:
$ pkg refresh --full
pkg: The image is currently in-use by another package client, pkg (pid
19654), and cannot be modified.
The packagemanager seems to fail gracefully as expected when the image
is already locked in cases that I've checked so far.
Unresolved
----------
I still need testing of image-update in an alternate BE scenario, and I
really want additional testing from team members if at all possible
before putback.
--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss