]> git.proxmox.com Git - mirror_zfs.git/commitdiff
2493 change efi_rescan() to wait longer
authorAndrew Hamilton <ahamilto@tjhsst.edu>
Wed, 13 Aug 2014 14:58:08 +0000 (10:58 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 26 Aug 2014 23:12:37 +0000 (16:12 -0700)
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

lib/libefi/rdwr_efi.c

index 19a573c0b1bd725c5a8ed4216749c8f66922961b..147e30a374adc8e2c55e3d64c1c76927274d0f32 100644 (file)
@@ -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