}
}
if (r >= 0)
- break;
+ goto success;
/* Device is being opened by another process, but it has not finished yet, yield for 2ms */
(void) usleep(2 * USEC_PER_MSEC);
}
- /* An existing verity device was reported by libcryptsetup/libdevmapper, but we can't use it at this time.
- * Fall back to activating it with a unique device name. */
- if (r < 0 && FLAGS_SET(flags, DISSECT_IMAGE_VERITY_SHARE))
+ /* All trials failed. Let's try to activate with a unique name. */
+ if (FLAGS_SET(flags, DISSECT_IMAGE_VERITY_SHARE))
return verity_partition(designator, m, v, verity, flags & ~DISSECT_IMAGE_VERITY_SHARE, d);
+ return log_debug_errno(SYNTHETIC_ERRNO(EBUSY), "All attempts to activate verity device %s failed.", name);
+
+success:
/* Everything looks good and we'll be able to mount the device, so deferred remove will be re-enabled at that point. */
restore_deferred_remove = mfree(restore_deferred_remove);