files: Fix service startup race condition with udev rules#311
files: Fix service startup race condition with udev rules#311quic-vkatoch wants to merge 1 commit intoqualcomm:developmentfrom
Conversation
|
@basak-qcom @lumag, could you please review this change? |
basak-qcom
left a comment
There was a problem hiding this comment.
The change itself looks good to me. Thanks! One comment inline on the autoconf change.
| [udevrulesdir="$withval"], | ||
| [udevrulesdir="/lib/udev/rules.d"]) | ||
| AC_MSG_NOTICE([udev rules directory: $udevrulesdir]) | ||
| AC_SUBST([udevrulesdir]) |
There was a problem hiding this comment.
Can you use pkg-config instead, querying for the udevdir variable? On Debian, /usr/lib/udev/rules.d is used (due to usrmerge), and I'd prefer for that to be automatic rather than have to use this project-specific --with-udevrulesdir or have the fallback diversion.
There was a problem hiding this comment.
It says "Get udev directory from pkg-config" but doesn't seem to be?
There was a problem hiding this comment.
So now the --with-udevrulesdir=DIR option is available, so if another distro wants to install the rules into a specific path, they can provide it explicitly. If we do not specify anything, the directory is taken from pkg-config. I just want to confirm that I am understanding this correctly.
Here is what I observe during Yocto compilation:
There was a problem hiding this comment.
Sorry I missed your reply before.
I understand that --with-udevrulesdir=DIR is available. But what I mean is that regardless of what distro you're building on, it shouldn't be necessary to use this option because pkg-config --variable=udevdir udev should provide the correct per-distro directory to use, and then autoconf should use that one automatically. It's fine to have an override, but it should never be necessary to use this.
The After= clause has no effect on the race between WantedBy=multi-user.target
and kernel module loading. If multi-user.target is reached before the kernel
module loads, the daemon will never start.
Fix by using ENV{SYSTEMD_WANTS} in udev rules to trigger services when
FastRPC devices are detected.
Changes:
- Add 71-fastrpc.rules with device-triggered service startup
- Remove [Install] sections from all service files
- Update configure.ac to use pkg-config to query udevdir variable
- Update files/Makefile.am to install udev rules
Services now start only when device nodes are created, eliminating the
race condition.
Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>
The After= clause has no effect on the race between WantedBy=multi-user.target and kernel module loading. If multi-user.target is reached before the kernel module loads, the daemon will never start.
Fix by using ENV{SYSTEMD_WANTS} in udev rules to trigger services when FastRPC devices are detected.
Changes:
Services now start only when device nodes are created, eliminating the race condition.
Fixes: #309