On Mon, 2011-05-16 at 18:59 +0200, Lennart Poettering wrote: > On Mon, 16.05.11 14:32, Michal Hlavinka (mhlavink@xxxxxxxxxx) wrote: > > when ups recieves command for shutdown, it does not shutdown power > > immediately, but after 30 seconds. Given that this command should be executed > > after umount, synced disks,... when everything is ready for power off... > > 30 seconds proved to be enough time for this. > > This is not the case and never has been the case. The root disks > traditionally could not be unmounted and hence MD/DM/MP and so on could > not be disassembled before going down. > > Delaying shutdown by 30s is hack, not a fix for a race. What race are we talking about exactly ? You do realize that the *UPS* itself is programmed to shut down after 30 seconds ? there is no sleep(30) here ... > > > UPS code like that needs to sit in the kernel itself to properly > > > work. Adding userspace kludges which invokes this from userspace is a > > > recipe for desaster. > > > > If *you* wan't to write kernel drivers for tons of UPS models using > > serial/usb/network/... connections with tons of protocols (with incomplete > > documentation)... it's your freedom to do so ;) > > Well, what can I say. I don't maintain UPS stuff, I don't use UPS > stuff. Oh this was *very* clear, no doubt you have never seen one. And given you haven't can you stop prescribing how things should work and instead discuss how we can make things work as things stand now ? You are the one pushing systemd, it is your duty to address the cases when it has to step out of the perfect world and actually meet the reality of how things actually work out there. > I am just pointing you to the fact that the current approach here > is racy, but sorry, I won't fix this for you. Given a lot of UPSes have "drivers" written in proprietary Java programs and communicate to the device via serial/usbserial, there isn't much you can do on the kernel driver front. You just need to provide for the right hooks so that the thing can be called as close as possible from the actual halt, when the root filesystem has been remounted r/o. And of course w/o killing the driver before that happens. Simo. -- Simo Sorce * Red Hat, Inc * New York -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel