Re: failing unmounts during reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 25, 2019 at 12:49 PM Frank Steiner <fsteiner-mail1@xxxxxxxxxxxxxx> wrote:
Hi,

I'm currently discussing a problem with the SuSE support about failing
unmounts during reboot. Tyring to debug this I realized that systemd
is not killing processes left over by some init.d script. E.g. use
the following script in /etc/init.d/

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: bla
# Required-Start: $network $remote_fs sshd
# Required-Stop: $network $remote_fs sshd
# Default-Start:  2 3 5
# Description:    test
### END INIT INFO
case "$1" in
      start) cd /test; /usr/bin/sleep 99d & ;;
       stop) true;;
esac


On shutdown, unmounting /test will fail because the sleep process is
not killed. Shouldn't there be a mechanism in system to kill processes
spawned by LSB script when shutting these down?

I think that's a deliberate decision made in the systemd-sysv-generator. Note how the generated .service files have "KillMode=process" (and even "RemainAfterExit=yes"). The default for native services is to kill the entire cgroup, and IIRC that even was one of the main reasons for using cgroups.

Most likely it's there to retain compatibility with some of the weirder init.d scripts – those which don't start any daemons; those which start several; and so on and so on.
 

And moreover, wouldn't it make sense to have a mechanism to at least
try to kill all processes using a filesystem before unmounting it?
We often see failing unmounts of several local or iscsi fs during
reboot, and in the support case we are currently working on with SuSE
failing iscsi fs even cause xfs I/O errors. So it might be a good idea
to have sth. like a lsof + kill before unmounting a filesystem, maybe
configurable with a flag to enable or disable it. Even if lsof or kill
failed, it wouldn't be worse than now.

IIRC the idea is that user sessions are killed during shutdown before unmounting anything anyway, and services have implicit After=local-fs.target so they get stopped before local filesystems? The shutdown process is one area that I still know very little about.
 

As far as I see there is no way to write a drop-in for a mount unit
that allows to execute commands before the unmount happens, is that
right? Sth. like "ExecPreUmount=" would help here, especially if there
was sth. like a umount@.service that would be called for every umount
with e.g. the mounpoint accessable with a variable.

No, there isn't.

--
Mantas Mikulėnas
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux