dissect-image: make verity_partition() actually fail when all attempts of activation failed

This commit is contained in:
Yu Watanabe
2022-09-17 05:18:25 +09:00
parent ad361a50fb
commit 9972e6d6ed
+6 -4
View File
@@ -2021,17 +2021,19 @@ static int verity_partition(
}
}
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);