Here is my issue. I want to (and in RHEL 6, do) have different behaviours when you do a stop or a restart for the multipathd service. On RHEL 6, when you stop the multipathd service, all your multipath devices stop queueing IO, if they have no remaining paths. If you are restarting the service, they continue to queue IO. In general, users will only be stopping multipathd on shutdown. The last thing you want in shutdown is to be hung because your multipath device is set to queue IO forever if there are no working paths. Many users do set up their systems this way. They only want their devices to stop queueing when the all failed paths are manually removed. However, once you start shutdown, it's time to give up and let that IO fail back, which is what multipathd does. On the other hand, users may be restarting the multipathd service because they have installed a new version. In this case, if they have any devices that are queueing because they are have no working paths, they do not what that IO getting failed back, and so multipathd doesn't fail it back. To have these different behaviors, the RHEL 6 init scripts run a command on restart to tell multipathd to not disable queueing when it shuts down. This would be simple to do if I could add a ExecRestartPre to the multipathd.service file. Or is there some other other way to get this behaviour that I don't know about?
Hmm I had looked into that a bit when I came across this in legacy sysv initscripts and in all of them ExecStartPre seemed to suffice so running this on every startup would that be harmful as in adding "ExecStartPre=-/path/to/command" to the unit file? Looking at the restart option there [1] it only calls the classic start/stop no magic is being done there restart() { stop start } Also there seems to be a quite a difference between the Red Hat initscript and the Suse one so if you need to increase the maximum number of FDS as is being done there in the suse one you can do so by adding LimitNOFILE=4096 to the unit ( or LimitNOFILE=infinity for unlimited ) 1.https://github.com/hreinecke/multipath-tools/blob/master/multipathd/multipathd.init.redhat
If you look at the RHEL6 redhat init scripts you will see the difference. I haven't post the change upstream, since it doesn't work with systemd, hence this bug. ExecStartPre doesn't help this situation. The issue is that when multipathd is stopped, it should disable queuing. When it is restarted, it shouldn't. Disabling queuing has to happen when the multipathd daemon stops, since you aren't doing anything else with it after that. I might be able to make ExecStopPost do the work. In order for that to work, ExecStopPost would need to either not be run on restarts. Or, I'd need to be able to pass to the command whether or not I'm doing a restart.