newfs silently fails if random is not ready (?)

Lev Serebryakov lev at FreeBSD.org
Wed Sep 5 11:42:29 UTC 2018


Hello Conrad,

Wednesday, September 5, 2018, 7:39:07 AM, you wrote:

> I believe the EWOULDBLOCK is just a boring leak of tsleep(9)'s timeout
> condition.  This may be sufficient to fix the problem:

> --- a/sys/dev/random/randomdev.c
> +++ b/sys/dev/random/randomdev.c
> @@ -156,6 +156,10 @@ READ_RANDOM_UIO(struct uio *uio, bool nonblock)
>                 error = tsleep(&random_alg_context, PCATCH, "randseed", hz/10);
>                 if (error == ERESTART || error == EINTR)
>                         break;
> +               /* Squash hz/10 timeout condition */
> +               if (error == EWOULDBLOCK)
> +                       error = 0;
> +               KASSERT(error == 0, ("unexpected %d", error));
>         }
>         if (error == 0) {
>                 read_rate_increment((uio->uio_resid +
> sizeof(uint32_t))/sizeof(uint32_t));

  Fantastic! Thanks!


-- 
Best regards,
 Lev                            mailto:lev at FreeBSD.org



More information about the freebsd-current mailing list