summaryrefslogtreecommitdiffstats
path: root/kernel/watch_queue.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2020-01-14 18:07:12 +0100
committerDavid Howells <dhowells@redhat.com>2020-05-19 16:40:28 +0200
commite7d553d69cf63aec7de0f38fed49ccbb30922e1e (patch)
treea10a83373994d18fb79809ddf9b62be7f57d4fff /kernel/watch_queue.c
parentpipe: Allow buffers to be marked read-whole-or-error for notifications (diff)
downloadlinux-e7d553d69cf63aec7de0f38fed49ccbb30922e1e.tar.xz
linux-e7d553d69cf63aec7de0f38fed49ccbb30922e1e.zip
pipe: Add notification lossage handling
Add handling for loss of notifications by having read() insert a loss-notification message after it has read the pipe buffer that was last in the ring when the loss occurred. Lossage can come about either by running out of notification descriptors or by running out of space in the pipe ring. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'kernel/watch_queue.c')
-rw-r--r--kernel/watch_queue.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index ad64ea300f6d..9a9699c06709 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -132,6 +132,8 @@ out:
return done;
lost:
+ buf = &pipe->bufs[(head - 1) & mask];
+ buf->flags |= PIPE_BUF_FLAG_LOSS;
goto out;
}