2493 change efi_rescan() to wait longer

Change efi_rescan() to loop 10 times instead of 5 on EBUSY and
to sleep at the end of each loop. This helps with some instances
where the kernel does not reload the partition table fast enough
for ZFS to detect.

Signed-off-by: Andrew Hamilton <ahamilto@tjhsst.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2493
This commit is contained in:
Andrew Hamilton 2014-08-13 10:58:08 -04:00 committed by Brian Behlendorf
parent 0426c16804
commit d09a99f96b

View File

@ -506,16 +506,17 @@ int
efi_rescan(int fd) efi_rescan(int fd)
{ {
#if defined(__linux__) #if defined(__linux__)
int retry = 5; int retry = 10;
int error; int error;
/* Notify the kernel a devices partition table has been updated */ /* Notify the kernel a devices partition table has been updated */
while ((error = ioctl(fd, BLKRRPART)) != 0) { while ((error = ioctl(fd, BLKRRPART)) != 0) {
if (--retry == 0) { if ((--retry == 0) || (errno != EBUSY)) {
(void) fprintf(stderr, "the kernel failed to rescan " (void) fprintf(stderr, "the kernel failed to rescan "
"the partition table: %d\n", errno); "the partition table: %d\n", errno);
return (-1); return (-1);
} }
usleep(50000);
} }
#endif #endif