[Pm-utils] lockfile creation not really atomic in pm-utils

Till Maas opensource at till.name
Tue Jan 8 11:42:51 PST 2008


On Fri January 4 2008, Victor Lowther wrote:
> Or move the lock directory to a location that is (or should be
> auto-cleaned), like /tmp, or just clean it ourselves with a boot-time
> init script.

An init script only to remove the lock directory, seems to be too much 
overkill to me.

> Using PID values seems like a waste of time if you are using them to
> detect stale lockfiles over reboots -- the presence or absence of a
> given PID is meaningless in that case.

The absence of a given PID always means that the lockdirectory is stale, but 
in case it is present after a reboot, there is a problem. What could help 
imho here, would be to store the last boot time[1] and then and compare it 
with a value that was stored in the lockdirectory. In case they do not match, 
then the lockdirectory is also stale.

> If there is a case in which suspend/resume fails, the system does not
> reboot (or hang and get rebooted), and the lock directory does not get
> removed, then that is a fault in the pm-utils scripting that needs
> fixed (imao).

I agree here, but I do not know, whether this is currently the case or not.

Regards,
Till

[1] This would be enough: LANG=C last -1 reboot | head -n1 | cut -d"(" -f1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/pm-utils/attachments/20080108/9c73ae94/attachment.pgp 


More information about the Pm-utils mailing list