Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Sep 2018 14:42:19 +0300
From:      Lev Serebryakov <lev@FreeBSD.org>
To:        Conrad Meyer <cem@freebsd.org>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>,  FreeBSD Current <freebsd-current@freebsd.org>, Xin LI <delphij@freebsd.org>
Subject:   Re: newfs silently fails if random is not ready (?)
Message-ID:  <532863197.20180905144219@serebryakov.spb.ru>
In-Reply-To: <CAG6CVpWMxhYJ=tjDgAkn1BJqPuyMgCaPbPdcGzFh3Oj5nox8MQ@mail.gmail.com>
References:  <609400979.20180904230820@serebryakov.spb.ru>  <CAG6CVpWzaBGvEdpNBrMQSPkxBn6pybP0SWyuYUhg0Qev4RvLwA@mail.gmail.com> <1942661439.20180904235514@serebryakov.spb.ru> <CAG6CVpWmXPUZAozTdJa%2BrczVyo9wHqr=uLP2U-O%2BPytSWr6_Ug@mail.gmail.com> <774228883.20180905001035@serebryakov.spb.ru> <CAG6CVpV7h5cuhC1o1qEqj%2BCxdnU1AHE4mPJW9KM4UCGv_u-%2BYA@mail.gmail.com> <CAG6CVpWMxhYJ=tjDgAkn1BJqPuyMgCaPbPdcGzFh3Oj5nox8MQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?532863197.20180905144219>