From d09a99f96b4399cb0e2611b4b57c9e64d6097e19 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Wed, 13 Aug 2014 10:58:08 -0400 Subject: [PATCH] 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 Signed-off-by: Brian Behlendorf Closes #2493 --- lib/libefi/rdwr_efi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libefi/rdwr_efi.c b/lib/libefi/rdwr_efi.c index 19a573c0b..147e30a37 100644 --- a/lib/libefi/rdwr_efi.c +++ b/lib/libefi/rdwr_efi.c @@ -506,16 +506,17 @@ int efi_rescan(int fd) { #if defined(__linux__) - int retry = 5; + int retry = 10; int error; /* Notify the kernel a devices partition table has been updated */ while ((error = ioctl(fd, BLKRRPART)) != 0) { - if (--retry == 0) { + if ((--retry == 0) || (errno != EBUSY)) { (void) fprintf(stderr, "the kernel failed to rescan " "the partition table: %d\n", errno); return (-1); } + usleep(50000); } #endif