dissect: yield for 2ms when a verity device cannot be opened before retrying

If we don't succeed on the first try it's because another process is
opening the same device. Do a microsleep for 2ms to increase the
chances it has completed the next time around the loop.
This commit is contained in:
Luca Boccassi 2020-08-10 11:22:30 +01:00
parent 9ecb5c10fd
commit ecab4c470c

View file

@ -1475,6 +1475,9 @@ static int verity_partition(
} }
if (r == 0) if (r == 0)
break; break;
/* 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. /* An existing verity device was reported by libcryptsetup/libdevmapper, but we can't use it at this time.