marsadm: deactivate unit upon detach

This commit is contained in:
Thomas Schoebel-Theuer 2019-02-02 20:47:41 +01:00 committed by Thomas Schoebel-Theuer
parent b7b9e6fed1
commit b951c13d1b
1 changed files with 4 additions and 0 deletions

View File

@ -477,6 +477,7 @@ sub systemd_activate {
$op = "stop";
}
_systemd_op($op, $unit);
return 1;
}
sub systemd_trigger {
@ -3118,6 +3119,9 @@ sub attach_res_phase0 {
if ($detach) {
my $device_in_use = get_link("$mars/resource-$res/actual-$host/open-count", 1);
if ($device_in_use) {
if (systemd_activate($cmd, $res, 0)) {
return;
}
my $name = get_link("$mars/resource-$res/device-$host");
my $dev = "/dev/mars/$name";
ldie "device '$dev' is in use\n";