Skip to content

Commit

Permalink
srp_daemon: Detect proper path to systemctl
Browse files Browse the repository at this point in the history
[ Upstream commit 05a19e0 ]

While debian uses /bin/systemctl, SUSE only supports /usr/bin/systemctl,
causing srp_daemon to fail silently starting on all ports.
Detect at built which path is the right one and use it.

Fixes: b03beb1 ("srp_daemon: Call systemctl properly from udev")
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
  • Loading branch information
nmorey committed Feb 18, 2022
1 parent dff45df commit f80d49e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ else()
set(CYTHON_EXECUTABLE "")
endif()

find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin")

RDMA_CheckSparse()

# Require GNU99 mode
Expand Down
5 changes: 3 additions & 2 deletions srp_daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ rdma_subst_install(FILES "srp_daemon.sh.in"
RENAME "srp_daemon.sh"
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)

install(FILES start_on_all_ports
rdma_subst_install(FILES start_on_all_ports.in
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/srp_daemon"
RENAME start_on_all_ports
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)

rdma_subst_install(FILES srp_daemon.service.in
Expand All @@ -43,7 +44,7 @@ rdma_subst_install(FILES srp_daemon_port@.service.in

install(FILES srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")

install(FILES "srp_daemon.rules"
rdma_subst_install(FILES "srp_daemon.rules.in"
RENAME "60-srp_daemon.rules"
DESTINATION "${CMAKE_INSTALL_UDEV_RULESDIR}")

Expand Down
1 change: 0 additions & 1 deletion srp_daemon/srp_daemon.rules

This file was deleted.

1 change: 1 addition & 0 deletions srp_daemon/srp_daemon.rules.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBSYSTEM=="infiniband_mad", KERNEL=="*umad*", PROGRAM=="@SYSTEMCTL_BIN@ show srp_daemon -p ActiveState", RESULT=="ActiveState=active", ENV{SYSTEMD_WANTS}+="srp_daemon_port@$attr{ibdev}:$attr{port}.service"
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
for p in /sys/class/infiniband/*/ports/*; do
[ -e "$p" ] || continue
p=${p#/sys/class/infiniband/}
nohup /bin/systemctl start "srp_daemon_port@${p/\/ports\//:}" </dev/null >&/dev/null &
nohup @SYSTEMCTL_BIN@ start "srp_daemon_port@${p/\/ports\//:}" </dev/null >&/dev/null &
done

0 comments on commit f80d49e

Please sign in to comment.