Re: newfs silently fails if random is not ready (?)

From: Lev Serebryakov <lev_at_FreeBSD.org>
Date: Wed, 5 Sep 2018 14:42:19 +0300
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
> _at__at_ -156,6 +156,10 _at__at_ 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
Received on Wed Sep 05 2018 - 09:42:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC