[systemd-devel] Fwd: Handling ExecStop failure
Ashish Sangwan
ashishsangwan2 at gmail.com
Mon May 23 08:00:55 UTC 2016
We have a user space file system implementation.
Lets say the binary name is user_fs
Execution/Mounting is done by using "systemctl start user_fs.service"
and stop/umounting is done by using "systemctl stop user_fs.service"
The service file looks like following:
[Service]
KillMode=none
Type=forking
ExecStop=/opt/scripts/user_fs stop
ExecStart=/opt/scripts/user_fs start
Restart=on-failure
RestartSec=10
StartLimitBurst=3
StartLimitInterval=60s
StandardError=journal+console
StandardOutput=journal+console
[Install]
WantedBy=default.target
When the mountpoint is busy, the ExecStop fails to umount which is expected.
user_fs.service -
Loaded: loaded (/etc/systemd/system/user_fs.service; enabled)
Active: failed (Result: exit-code) since Mon 2016-05-23
01:56:15 EDT; 18min ago
Process: 22360 ExecStop=/opt/scripts/user_fs stop (code=exited, status=32)
Process: 21933 ExecStart=/opt/scripts/user_fs start
(code=exited, status=0/SUCCESS)
Main PID: 21988
May 23 01:56:15 perfnode105 user_fs [22360]: Running umount /mnt
May 23 01:56:15 perfnode105 user_fs [22360]: umount: /mnt: target is busy
May 23 01:56:15 perfnode105 user_fs[22360]: (In some cases useful
info about processes that
May 23 01:56:15 perfnode105 user_fs[22360]: use the device is
found by lsof(8) or fuser(1).)
The first issue is, once the command mentioned in ExecStop failed due
to mountpoint busy, the user comes out of the mountpoint, making it
un-busy and again fires the systemctl stop command, however the status
of the service is not changed, it remained in failed state and the
mountpoint remains mounted.
We have to explicitly do umount and kill the process to clean it.
How can I avoid this issue so that once the mountpoint becomes
un-busy, executing systemctl stop again will complete successfully.
My second issue is, on failure of stopping/umounting, no failure
message appears on console although I have used StandardError option.
I will really appreciate any help.
Regards,
Ashish
More information about the systemd-devel
mailing list