Skip to content

Commit d09a99f

Browse files
Andrew Hamiltonbehlendorf
authored andcommitted
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#2493
1 parent 0426c16 commit d09a99f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/libefi/rdwr_efi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,16 +506,17 @@ int
506506
efi_rescan(int fd)
507507
{
508508
#if defined(__linux__)
509-
int retry = 5;
509+
int retry = 10;
510510
int error;
511511

512512
/* Notify the kernel a devices partition table has been updated */
513513
while ((error = ioctl(fd, BLKRRPART)) != 0) {
514-
if (--retry == 0) {
514+
if ((--retry == 0) || (errno != EBUSY)) {
515515
(void) fprintf(stderr, "the kernel failed to rescan "
516516
"the partition table: %d\n", errno);
517517
return (-1);
518518
}
519+
usleep(50000);
519520
}
520521
#endif
521522

0 commit comments

Comments
 (0)