From owner-freebsd-fs@freebsd.org Wed Sep 5 11:42:29 2018 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5DF3FECE13; Wed, 5 Sep 2018 11:42:28 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [148.251.9.81]) by mx1.freebsd.org (Postfix) with ESMTP id 896CA7D333; Wed, 5 Sep 2018 11:42:28 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from lion.home.serebryakov.spb.ru (unknown [94.19.235.70]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id 6C690CB0; Wed, 5 Sep 2018 14:42:21 +0300 (MSK) Date: Wed, 5 Sep 2018 14:42:19 +0300 From: Lev Serebryakov Reply-To: lev@FreeBSD.org Organization: FreeBSD Message-ID: <532863197.20180905144219@serebryakov.spb.ru> To: Conrad Meyer CC: freebsd-fs , FreeBSD Current , Xin LI Subject: Re: newfs silently fails if random is not ready (?) In-Reply-To: References: <609400979.20180904230820@serebryakov.spb.ru> <1942661439.20180904235514@serebryakov.spb.ru> <774228883.20180905001035@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 11:42:29 -0000 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