test: lock device during running cryptsetup
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 21 May 2024 20:24:05 +0000 (05:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 21 May 2024 20:37:02 +0000 (05:37 +0900)
commitbe43c9b0295120e508de1afd739af6fb7603186a
treea0c03c275701558dd7e369a1635a2699dfaa95fc
parentbb6ce6b6a463d0d6d19d0b258725412fa16c02e9
test: lock device during running cryptsetup

On running cryptsetup, udevd detects two inotify events for the
underlying device. Running the test on enough fast host, the expected
symlinks based on UUID and disk label are created by the second event.

During processing a uevent for a device, udevd disables the inotify
watch for the device. If the test runs on slow system, the second
inotify event may comes during a udev worker processing the synthesized
uevent triggered by the first inotify event. Hence, no synthesized
uevent for the second inotify event will be generated, and the expected
symlinks will be never created.

To prevent the issue, we need to lock the device during cryptsetup
command is running.

Fixes #32913.
test/units/TEST-64-UDEV-STORAGE.sh