pk: Fix race in acquire_lockfile()
pk: Fix race in acquire_lockfile()

- Since we unlink the lockfile before closing it, there is a race in which
one PK instance acquires a lock on an fd to a lockfile which has just been
deleted by an exiting PK process, while another instance creates a new
lockfile and acquires a lock on it.  To prevent the race, we fstat the
lockfile fd after acquiring the lock, and check that nlink == 1.  If not,
the lockfile has been deleted, so we try again.

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