client: Add locking to hoard cache image directory
client: Add locking to hoard cache image directory

- Add parameter to acquire_lock() specifying whether we should wait for an
existing lock rather than erroring out immediately.  Update callers to
request *not* waiting, matching existing practice.

- Add release_lock(), which releases one lock from the current set of
acquired locks

- In checkout() and hoard(), acquire a lock (uuid.lock) on the parcel's
hoard images (uuid.cfg and uuid.key) while working with them, in order to
prevent various races (e.g. between simultaneous checkout and hoard).  We
only hold the lock while actually working with the image files.  If the lock
is already held, wait for it to become free.

cmusatyalab/openisr,cmusatyalab/openisr,cmusatyalab/openisr,cmusatyalab/openisr,cmusatyalab/openisr