mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
bcachefs: thread_with_stdio: fix spinning instead of exiting
bch2_stdio_redirect_vprintf() was missing a check for stdio->done, i.e. exiting. This caused the thread attempting to print to spin, and since it was being called from the kthread ran by thread_with_stdio, the userspace side hung as well. Change it to return -EPIPE - i.e. writing to a pipe that's been closed. Reported-by: Jan Solanti <jhs@psonet.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
6846100b00
commit
df2e19a883
1 changed files with 3 additions and 1 deletions
|
|
@ -455,8 +455,10 @@ ssize_t bch2_stdio_redirect_vprintf(struct stdio_redirect *stdio, bool nonblocki
|
|||
struct stdio_buf *buf = &stdio->output;
|
||||
unsigned long flags;
|
||||
ssize_t ret;
|
||||
|
||||
again:
|
||||
if (stdio->done)
|
||||
return -EPIPE;
|
||||
|
||||
spin_lock_irqsave(&buf->lock, flags);
|
||||
ret = bch2_darray_vprintf(&buf->buf, GFP_NOWAIT, fmt, args);
|
||||
spin_unlock_irqrestore(&buf->lock, flags);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue