Bug 818052 - RFE: Could an ExecRestartPre option be added for the service files.
Summary: RFE: Could an ExecRestartPre option be added for the service files.
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: systemd-RFE
TreeView+ depends on / blocked
 
Reported: 2012-05-02 05:45 UTC by Ben Marzinski
Modified: 2022-08-12 14:27 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-08-12 14:27:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github systemd systemd issues 2175 0 None open Support configcheck before stop/restart of service 2022-08-12 14:27:44 UTC

Description Ben Marzinski 2012-05-02 05:45:09 UTC
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?

Comment 1 Jóhann B. Guðmundsson 2012-08-09 00:05:17 UTC
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

Comment 2 Ben Marzinski 2012-08-14 17:13:00 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.