summaryrefslogtreecommitdiff
path: root/fs/bcachefs/thread_with_file.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-09 04:41:34 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-14 04:22:04 +0300
commita5a650d6472f238191d98d8aba7536a9fb3d9f99 (patch)
tree6c58a5e48f6103bc7019625c2d4fe756053441ac /fs/bcachefs/thread_with_file.c
parent5c3273ec3c6af356b29ff50a654f0dc33bf25a83 (diff)
downloadlinux-a5a650d6472f238191d98d8aba7536a9fb3d9f99.tar.xz
bcachefs: thread_with_stdio: suppress hung task warning
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/thread_with_file.c')
-rw-r--r--fs/bcachefs/thread_with_file.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/bcachefs/thread_with_file.c b/fs/bcachefs/thread_with_file.c
index 83186e824e88..96ac2b2c60e1 100644
--- a/fs/bcachefs/thread_with_file.c
+++ b/fs/bcachefs/thread_with_file.c
@@ -9,6 +9,7 @@
#include <linux/kthread.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
+#include <linux/sched/sysctl.h>
void bch2_thread_with_file_exit(struct thread_with_file *thr)
{
@@ -264,7 +265,15 @@ int bch2_stdio_redirect_read(struct stdio_redirect *stdio, char *ubuf, size_t le
{
struct stdio_buf *buf = &stdio->input;
- wait_event(buf->wait, stdio_redirect_has_input(stdio));
+ /*
+ * we're waiting on user input (or for the file descriptor to be
+ * closed), don't want a hung task warning:
+ */
+ do {
+ wait_event_timeout(buf->wait, stdio_redirect_has_input(stdio),
+ sysctl_hung_task_timeout_secs * HZ / 2);
+ } while (!stdio_redirect_has_input(stdio));
+
if (stdio->done)
return -1;
@@ -287,7 +296,11 @@ int bch2_stdio_redirect_readline(struct stdio_redirect *stdio, char *ubuf, size_
size_t copied = 0;
ssize_t ret = 0;
again:
- wait_event(buf->wait, stdio_redirect_has_input(stdio));
+ do {
+ wait_event_timeout(buf->wait, stdio_redirect_has_input(stdio),
+ sysctl_hung_task_timeout_secs * HZ / 2);
+ } while (!stdio_redirect_has_input(stdio));
+
if (stdio->done) {
ret = -1;
goto out;