Red Hat Bugzilla – Bug 976188
target_core_iblock still opens the mpath device after stopping targetcli
Last modified: 2015-01-26 19:11:50 EST
Description of problem:
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. /backstores/block> create dev=/dev/mapper/mpathc name=mpathc
2. save and exit targetcli
3. service targetcli stop
4. multipath -F
5. check target_core_iblock, it's still in use
[root@storageqe-13 network-scripts]# lsmod | grep bloc
target_core_iblock 18075 1
target_core_mod 285866 9
Jun 20 01:37:08 | mpathc: map in use
Jun 20 01:37:08 | failed to remove multipath map mpathc
I could duplicate this behavior if the targetcli service was never started. In this case, "service targetcli stop" doesn't actually run the service stop command -- systemd is perhaps being too smart.
Solutions to this would be starting the service before calling stop, or running the command that stop runs: "targetcli clearconfig confirm=true", instead of "service targetcli stop".
Closing, please feel free to reopen if needed.
(In reply to Andy Grover from comment #2)
> I could duplicate this behavior if the targetcli service was never started.
> In this case, "service targetcli stop" doesn't actually run the service stop
> command -- systemd is perhaps being too smart.
> Solutions to this would be starting the service before calling stop, or
> running the command that stop runs: "targetcli clearconfig confirm=true",
> instead of "service targetcli stop".
> Closing, please feel free to reopen if needed.
yes, targetcli clearconfig confirm=true can fix this issue. but I have checked the /usr/lib/systemd/system/targetcli.service, it should issue the mentioned command when executing service targetcli stop.
ExecStop=/usr/bin/targetcli clearconfig confirm=true
from my side, service targetcli stop should have the same function of 'targetcli clearconfig confirm=true', can you explain why 'service targetcli stop' does not work?
systemd only stops running services. On traditional SysV a K link installed for shutdown was executed when going down regardless whether the service was started before or not. systemd is more strict here and does not stop service that weren't started in the first place.
So unless systemd thinks the targetcli service is started, the ExecStop line won't be called.