Index: sys/boot/i386/zfsboot/zfsboot.c =================================================================== --- sys/boot/i386/zfsboot/zfsboot.c (revision 302689) +++ sys/boot/i386/zfsboot/zfsboot.c (working copy) @@ -391,7 +391,7 @@ return (newdsk); } -static void +static int probe_drive(struct dsk *dsk) { #ifdef GPT @@ -412,7 +412,7 @@ * If we find a vdev on the whole disk, stop here. */ if (vdev_probe(vdev_read, dsk, NULL) == 0) - return; + return (0); #ifdef LOADER_GELI_SUPPORT /* @@ -428,7 +428,7 @@ if (geli_taste(vdev_read, dsk, elba) == 0) { if (geli_passphrase(&gelipw, dsk->unit, ':', 0, dsk) == 0) { if (vdev_probe(vdev_read, dsk, NULL) == 0) { - return; + return (0); } } } @@ -442,7 +442,7 @@ * First check for GPT. */ if (drvread(dsk, sec, 1, 1)) { - return; + return (1); } memcpy(&hdr, sec, sizeof(hdr)); if (memcmp(hdr.hdr_sig, GPT_HDR_SIG, sizeof(hdr.hdr_sig)) != 0 || @@ -465,7 +465,7 @@ while (slba < elba) { dsk->start = 0; if (drvread(dsk, sec, slba, 1)) - return; + return (1); for (part = 0; part < entries_per_sec; part++) { ent = (struct gpt_ent *)(sec + part * hdr.hdr_entsz); if (memcmp(&ent->ent_type, &freebsd_zfs_uuid, @@ -502,12 +502,12 @@ } slba++; } - return; + return (0); trymbr: #endif /* GPT */ if (drvread(dsk, sec, DOSBBSECTOR, 1)) - return; + return (1); dp = (void *)(sec + DOSPARTOFF); for (i = 0; i < NDOSPART; i++) { @@ -537,12 +537,14 @@ } #endif /* LOADER_GELI_SUPPORT */ } + + return (0); } int main(void) { - int autoboot, i; + int autoboot, i, err; dnode_phys_t dn; off_t off; struct dsk *dsk; @@ -591,7 +593,7 @@ * Probe the boot drive first - we will try to boot from whatever * pool we find on that drive. */ - probe_drive(dsk); + err = probe_drive(dsk); /* * Probe the rest of the drives that the bios knows about. This @@ -604,7 +606,8 @@ for (i = 0; i < MAXBDDEV; i++) #endif { - if ((i | DRV_HARD) == *(uint8_t *)PTOV(ARGS)) + /* Only skip the boot drive if reading from it did not fail */ + if (err == 0 && (i | DRV_HARD) == *(uint8_t *)PTOV(ARGS)) continue; if (!int13probe(i | DRV_HARD))