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: * modifying the "iscsiadm -k" command to require passing in the PID of the daemon to be killed * modifying the iscsiadm to only call kill_iscsid() if positive PID is passed in, and that PID exists. It verifies this by sending a blank signal to the process. * modifying the iscsid.service systemd unit file so that the ExecStop command becomes "iscsiadm -k 0 $MAINPID" I know other distributions are having been dealing with iscsid service shutdown issues with systemd for a while now. Perhaps somebody else has a better solution? -- 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 open-iscsi+unsubscr...@googlegroups.com. To post to this group, send email to open-iscsi@googlegroups.com. Visit this group at https://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.