ts_init_subtest "find-race-condition"
LODEV=$( $TS_CMD_LOSETUP --find --nooverlap --show $BACKFILE )
$TS_CMD_LOSETUP -d $LODEV
+# The loop device may or may not exist here because no "udevadm settle".
LODEV=$( $TS_CMD_LOSETUP --find --nooverlap --show $BACKFILE )
sleep 3
dd if=/dev/zero of=$LODEV count=1 bs=1 >/dev/null 2>&1
sleep 3
$TS_CMD_LOSETUP --list | grep -q $LODEV
ts_log $?
+udevadm settle
$TS_CMD_LOSETUP -d $LODEV >/dev/null 2>&1
ts_log "Success"
ts_finalize_subtest
if [ -z "$LODEVR" ]; then
ts_log "Failed to create loop device"
fi
+udevadm settle
if test "$LODEV" = "$LODEVR" ; then
echo "equal" >>$TS_OUTPUT
else
if [ -z "$LODEVR" ]; then
ts_log "Failed to create loop device"
fi
+udevadm settle
if test "$LODEV" = "$LODEVR" ; then
echo "equal" >>$TS_OUTPUT
else
if [ -z "$LODEVR" ]; then
ts_log "Failed to create loop device"
fi
+udevadm settle
if test "$LODEV" = "$LODEVR" ; then
echo "equal" >>$TS_OUTPUT
else
if [ -z "$LODEVR" ]; then
ts_log "Failed to create loop device"
fi
+udevadm settle
if test "$LODEV" = "$LODEVR" ; then
echo "equal" >>$TS_OUTPUT
else
if [ -z "$LODEVR" ]; then
ts_log "Failed to create loop device"
fi
+udevadm settle
if test "$LODEV" = "$LODEVR" ; then
echo "equal" >>$TS_OUTPUT
else
if [ -z "$LODEVR" ]; then
ts_log "Failed to create loop device"
fi
+udevadm settle
if test "$LODEV" = "$LODEVR" ; then
echo "equal" >>$TS_OUTPUT
else
LODEVR=$( $TS_CMD_LOSETUP --find )
$TS_CMD_LOSETUP --nooverlap $LODEVR $BACKFILE >/dev/null 2>&1
ts_log $?
+udevadm settle
$TS_CMD_LOSETUP -d $LODEV
$TS_CMD_LOSETUP -d $LODEVR >/dev/null 2>&1
ts_log "Success"
LODEVR=$( $TS_CMD_LOSETUP --find )
$TS_CMD_LOSETUP --nooverlap $LODEVR $BACKFILE >/dev/null 2>&1
ts_log $?
+udevadm settle
$TS_CMD_LOSETUP -d $LODEV
$TS_CMD_LOSETUP -d $LODEVR >/dev/null 2>&1
ts_log "Success"