On Jun 20, 2024 / 19:41, Shin'ichiro Kawasaki wrote: > The current implementation of the test case loop/010 assumes that the > prepared loop device is /dev/loop0, which is not always true. When other > loop devices are set up before the test case run, the assumption is > wrong and the test case fails. > > To avoid the failure, use the prepared loop device name stored in > $loop_device instead of /dev/loop0. Adjust the grep string to meet the > device name. Also use "losetup --detach" instead of > "losetup --detach-all" to not detach the loop devices which existed > before the test case runs. > > Fixes: 1c4ae4fed9b4 ("loop: Detect a race condition between loop detach and open") > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx> > --- > tests/loop/010 | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > > diff --git a/tests/loop/010 b/tests/loop/010 > index ea396ec..f8c6f2c 100755 > --- a/tests/loop/010 > +++ b/tests/loop/010 > @@ -16,18 +16,26 @@ requires() { > } > > create_loop() { > + local dev > + > while true > do > - loop_device="$(losetup --partscan --find --show "${image_file}")" > - blkid /dev/loop0p1 >& /dev/null > + dev="$(losetup --partscan --find --show "${image_file}")" > + if [[ $dev != "$1" ]]; then > + echo "Unepxected loop device set up: $dev" > + return > + fi > + blkid "$dev" >& /dev/null To correspond to "/dev/loop0p1", the "$dev" above should be "$dev"p1. I forgot to add "p1" and this missing p1 looks slightly lowers the failure detection ratio. Will fix it in v2.