浏览代码

swupdate: Set service type to exec

swupdate service launches a shell script which is responsible for
launcing swupdate core. Default service type considers that unit
is started right after main process is forked, and dependent services
can be launched right away, however it take some time for swupdate
core to initialize. This causes swupdate-client, launched by
swupdate-usb service, to end up in a race condition if swupdate-usb
service is launched right after swupdate service as service manager
considers that swupdate unit is fully running, whereas swupdate core
has not completely initialized yet. This results in immature launcing of
swupdate-client and it fails with "swupdate_async_start returns -1"
because host socket are not initialized yet in swupdate core for
the client to connect to.
When service type is set to "exec" service manager considers that a
service unit is started after the main process binary is executed
making sure that dependent services are not launched till core is
initialized. swupdate.sh uses exec to launch swupdate core this makes
sure that swupdate.sh is considered executed only once swupdate core
is running.
This commits sets service type to "exec" and makes use of the way
swupdate.sh executes swupdate core using exec command to make sure
that swupdate-client and core do not end up in race condition.

Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Muhammad Hamza 3 年之前
父节点
当前提交
9bf385c036
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      recipes-support/swupdate/swupdate/swupdate.service

+ 1 - 0
recipes-support/swupdate/swupdate/swupdate.service

@@ -4,6 +4,7 @@ Documentation=https://github.com/sbabic/swupdate
 Documentation=https://sbabic.github.io/swupdate
 
 [Service]
+Type=exec
 ExecStart=@LIBDIR@/swupdate/swupdate.sh
 KillMode=mixed