All of lore.kernel.org
 help / color / mirror / Atom feed
From: Franck Bui <fbui@suse.de>
To: Benjamin Brunner <bbrunner@suse.com>, Coly Li <colyli@suse.de>,
	NeilBrown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org,
	mtkaczyk <mariusz.tkaczyk@linux.intel.com>,
	Jes Sorensen <jsorensen@fb.com>
Subject: Re: [PATCH] mdadm/systemd: change KillMode from none to mixed in service files
Date: Wed, 8 Dec 2021 17:25:05 +0100	[thread overview]
Message-ID: <4db89d7a-88c1-494f-359b-359e355d9b55@suse.de> (raw)
In-Reply-To: <28a04276-d338-2db5-bb3d-49616e14206b@suse.com>

Hi,

On 12/7/21 1:34 PM, Benjamin Brunner wrote:
>>>> Please correct me if I am wrong, I see the difference of the KillMode is,
>>>> -- KillMode=mixed stops the processes more gentally, it kill the main
>>>> process with SIGTERM and the remaining processes with SIGKILL.
>>>> -- KillMode=control-group kills all in-cgroup processes with SIGKILL,
>>>> which I feel a bit cruel for the main process.

I think there's a miss-understanding here.

Regardless of whether "mixed" or "control-group" mode (or any other mode
actually) is used, the process used to kill processes part of a service is
always the same, only the list of the killed processes differs.

The process is as follow:

 1. send the signal specified by KillSignal= to the list of processes (if
    any), TERM is the default
 2. wait until either the target of process(es) exit or a timeout expires
 3. if the timeout expires send the signal specified by FinalKillSignal=,
    KILL is the default

For "control-group", all remaining processes will receive the SIGTERM signal (by
default) and if there are still processes after a period f time, they will get
the SIGKILL signal.

For "mixed", only the main process will receive the SIGTERM signal, and if there
are still processes after a period of time, all remaining processes (including
the main one) will receive the SIGKILL signal.

>>> There is no point sending SIGTERM to a process which doesn't respond to
>>> it.  mdmon is the only mdadm service which handles SIGTERM.  So it might
>>> make sense to uise KillMode=mixed for that.
>>> For anything else, SIGKILL via KillMode=control-group is perfectly
>>> acceptable.

I don't know enough mdadm to suggest a mode but maybe the clarification above
will help you figuring this out.

That said it sounds a bit strange that some processes don't respond to SIGTERM.
Is that done because some services need to run lately during the shutdown process ?

Thanks.

  reply	other threads:[~2021-12-08 16:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  6:22 [PATCH] mdadm/systemd: change KillMode from none to mixed in service files Coly Li
2021-12-01 16:08 ` mtkaczyk
2021-12-01 16:23   ` Coly Li
2021-12-01 16:28     ` Benjamin Brunner
2021-12-01 16:43       ` Coly Li
2021-12-01 21:51         ` NeilBrown
2021-12-05 13:42           ` Coly Li
2021-12-07 12:34             ` Benjamin Brunner
2021-12-08 16:25               ` Franck Bui [this message]
2021-12-08 21:27                 ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4db89d7a-88c1-494f-359b-359e355d9b55@suse.de \
    --to=fbui@suse.de \
    --cc=bbrunner@suse.com \
    --cc=colyli@suse.de \
    --cc=jsorensen@fb.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=mariusz.tkaczyk@linux.intel.com \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.