pk: Detect and reopen deleted logfile
pk: Detect and reopen deleted logfile

- fstat() the logfile before writing to it, and if it no longer has any
directory entries, reopen it.  This should prevent (many) log entries from
being dropped by a long-running PK process (e.g. hoard) running concurrently
with a checkin.

- Move log opening and closing into helper functions

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