From: Yu Watanabe Date: Thu, 24 Jul 2025 19:12:10 +0000 (+0900) Subject: TEST-10-MOUNT: wait for userspace mount options being loaded X-Git-Tag: v258-rc2~91^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F38327%2Fhead;p=thirdparty%2Fsystemd.git TEST-10-MOUNT: wait for userspace mount options being loaded When a device is mounted with userspace options such as _netdev, even when the mount event source is triggered, only /proc/self/mountinfo may be updated, and /run/mount/utab may not be updated yet. Hence, the mount unit may be created/updated without the userspace options. In that case, the mount event source will be retriggered when /run/mount/utab is updated, and the mount unit will be updated again with the userspace options. Typically, the window between the two calls is very short, but when the mount event source is ratelimited after the first event, processing the second event may be delayed about 1 secound. Hence, here we need to wait for a while. By adding a debugging logs in mount_setup_unit(), the userspace mount is not obtained in the first event, and the second event is delayed by the ratelimit. ``` [ 20.023086] H TEST-10-MOUNT.sh[446]: + mount -t ext4 -o _netdev /dev/loop1p1 /tmp/deptest [ 20.026255] H kernel: EXT4-fs (loop1p1): mounted filesystem c1fa00ea-2ba8-46b2-9002-2ac997f4cda9 r/w with ordered data mode. Quota mode: none. [ 20.026537] H TEST-10-MOUNT.sh[446]: + timeout 10 bash -c 'until systemctl -q is-active tmp-deptest.mount; do sleep .1; done' [ 20.032293] H systemd[1]: tmp-deptest.mount: mount_setup_unit: proc: yes, netdev: no [ 20.035978] H systemd[1]: Unit blockdev@dev-loop1p1.target has alias blockdev@.target. [ 20.039765] H systemd[1]: tmp-deptest.mount: Changed dead -> mounted [ 20.046598] H systemd[1]: Event source 0x7c73093e05e0 (mount-monitor-dispatch) entered rate limit state. ``` Hopefully fixes #32712. --- diff --git a/test/units/TEST-10-MOUNT.sh b/test/units/TEST-10-MOUNT.sh index 77b0520a968..b4c867918f3 100755 --- a/test/units/TEST-10-MOUNT.sh +++ b/test/units/TEST-10-MOUNT.sh @@ -82,6 +82,14 @@ check_dependencies() { # mount LOOP_1 (using fake _netdev option) mount -t ext4 -o _netdev "${LOOP_1}p1" /tmp/deptest timeout 10 bash -c 'until systemctl -q is-active tmp-deptest.mount; do sleep .1; done' + # When a device is mounted with userspace options such as _netdev, even when the mount event source is + # triggered, only /proc/self/mountinfo may be updated, and /run/mount/utab may not be updated yet. + # Hence, the mount unit may be created/updated without the userspace options. In that case, the mount + # event source will be retriggered when /run/mount/utab is updated, and the mount unit will be updated + # again with the userspace options. Typically, the window between the two calls is very short, but when + # the mount event source is ratelimited after the first event, processing the second event may be delayed + # about 1 secound. Hence, here we need to wait for a while. + timeout 10 bash -c 'until systemctl show --property=After --value tmp-deptest.mount | grep -q -F remote-fs-pre.target; do sleep .1; done' after=$(systemctl show --property=After --value tmp-deptest.mount) assert_not_in "local-fs-pre.target" "$after" assert_in "remote-fs-pre.target" "$after"