* random: Wake up writers when random pools are zapped
@ 2018-05-18 6:57 Herbert Xu
2018-05-19 21:55 ` Theodore Y. Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2018-05-18 6:57 UTC (permalink / raw)
To: Theodore Ts'o, Linux Kernel Mailing List
As it is when the pool is zapped with RNDCLEARPOOL writers are
not woken up and therefore the pool may remain in the empty state
indefinitely.
This patch wakes them up unless the write threshold is set to zero.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/drivers/char/random.c b/drivers/char/random.c
index e027e7f..32b7010 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1874,6 +1874,10 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
return -EPERM;
input_pool.entropy_count = 0;
blocking_pool.entropy_count = 0;
+ if (random_write_wakeup_bits) {
+ wake_up_interruptible(&random_write_wait);
+ kill_fasync(&fasync, SIGIO, POLL_OUT);
+ }
return 0;
default:
return -EINVAL;
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: random: Wake up writers when random pools are zapped
2018-05-18 6:57 random: Wake up writers when random pools are zapped Herbert Xu
@ 2018-05-19 21:55 ` Theodore Y. Ts'o
2018-05-20 3:02 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Theodore Y. Ts'o @ 2018-05-19 21:55 UTC (permalink / raw)
To: Herbert Xu; +Cc: Linux Kernel Mailing List
On Fri, May 18, 2018 at 02:57:36PM +0800, Herbert Xu wrote:
> As it is when the pool is zapped with RNDCLEARPOOL writers are
> not woken up and therefore the pool may remain in the empty state
> indefinitely.
>
> This patch wakes them up unless the write threshold is set to zero.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Thanks, applied.
Out of curiosity, how/when were you using RNDCLEARPOOL/RNDZAPENTCNT?
Hopefully it was only testing hw_random drivers, or some such?
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-20 3:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18 6:57 random: Wake up writers when random pools are zapped Herbert Xu
2018-05-19 21:55 ` Theodore Y. Ts'o
2018-05-20 3:02 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox