]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: Handle PTP device symlink properly on udev action 'change'
authorChengen Du <chengen.du@canonical.com>
Mon, 12 Aug 2024 03:41:52 +0000 (11:41 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 15 Aug 2024 06:38:46 +0000 (15:38 +0900)
PTP device symlink creation rules are currently executed only when the
udev action is 'add'. If a user reloads the rules and runs the udevadm
trigger command to reapply changes, the symlink may be deleted, which
can prevent the chronyd service from restarting properly.

Signed-off-by: Chengen Du <chengen.du@canonical.com>
rules.d/50-udev-default.rules.in

index 9b00c7037e0a4f17d6a818bb57ce458490da2251..6f80feeecf8ffe367f1bdc809d9a5f59c0175381 100644 (file)
@@ -30,6 +30,9 @@ SUBSYSTEM=="pci|usb|platform", IMPORT{builtin}="path_id"
 
 SUBSYSTEM=="net", IMPORT{builtin}="net_driver"
 
+SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK+="ptp_kvm"
+SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK+="ptp_hyperv"
+
 ACTION!="add", GOTO="default_end"
 
 SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666"
@@ -116,7 +119,4 @@ KERNEL=="vhost-net", GROUP="kvm", MODE="{{DEV_KVM_MODE}}", OPTIONS+="static_node
 
 KERNEL=="udmabuf", GROUP="kvm"
 
-SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK+="ptp_kvm"
-SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK+="ptp_hyperv"
-
 LABEL="default_end"