On Sat, 19 Nov 2016 at 19:46 The Lee-Man <[email protected]> wrote:
> In this wonderful new world of systemd, I have an issue with stopping the > iscsid service when the daemon has died or been killed. > > My setup: > * I have an iscsid.socket unit file, which is enabled and started > * I have an iscsid.service unit file, which controls the iscsid daemon. > This is disabled and not started > > Normally, if I run a command like "iscsiadm -m discovery -t st -p > SOME-TARGET", systemd notices that iscsiadm is trying to talk to iscsid > through the socket, and it starts up iscsid. This is the cool part (IMHO) > of systemd socket activation. > > When I want to stop iscsid, I can just tell systemctl to do it via > "systemctl stop iscsid", and it runs the "ExecStop=" command in the service > unit file, which is "iscsiadm -k 0 2" before terminating the daemon > process(es). > > [NOTE: the "2" here in this command actually does nothing and is ignored, > but I copied this from someplace else long ago, and the "2" was present > there.] > > It is of importance, in this case, that the ExecStop command actually > sends an IPC message to the daemon (iscsid) requesting it to cleanly shut > itself down. Herein lies the rub. > > All of this works great until the daemon happens not to be running. You > can simulate this with "kill -TERM $(pidof iscsid)" when the daemon is > running. Now you are in a situation where systemd started the service and > knows it is now not running, so it seems to send the ExecStop command to > cleanly shut it down. This command hangs! It seems to be stuck in an > infinite loop trying to send the shutdown command to the daemon, waiting > for it to timeout, then trying again. The daemon starts up, sees an IPC > error, and exits. > > While this clearly seems like a systemd issue, I have found a workaround > that looks clean. Well, as clean as the shutdown command is, anyway. This > involves: > How is this systemd's issue? From what you wrote above, it looks like isciadm -k is trying to stop iscsid daemon without even checking if iscsid daemon is running. > * modifying the "iscsiadm -k" command to require passing in the PID of the > daemon to be killed > is it possible to run more than one daemon on the same server? Maybe it will be enough just to modify iscsiadm to check first if daemon is running before trying to stop it? Misha -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
