From b951c13d1b590d4d968c1ebf9e21da0550c1f872 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sat, 2 Feb 2019 20:47:41 +0100 Subject: [PATCH] marsadm: deactivate unit upon detach --- userspace/marsadm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/userspace/marsadm b/userspace/marsadm index 0fdc55fd..554cb8f7 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -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";