Re: [PATCH 1/3] pidfd_poll: report POLLHUP when pid_task() == NULL

From: Christian Brauner
Date: Fri Feb 02 2024 - 10:16:42 EST


On Fri, Feb 02, 2024 at 03:44:45PM +0100, Christian Brauner wrote:
> > TODO: change do_notify_pidfd() to use the keyed wakeups.
>
> How does the following appended patch look?

I missed the conversion in detach_pid() which should also just become:

diff --git a/kernel/pid.c b/kernel/pid.c
index de0bf2f8d18b..1bfcfa195226 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -351,7 +351,8 @@ static void __change_pid(struct task_struct *task, enum pid_type type,

if (type == PIDTYPE_PID) {
WARN_ON_ONCE(pid_has_task(pid, PIDTYPE_PID));
- wake_up_all(&pid->wait_pidfd);
+ pidfd_wake_up_poll(&pid->wait_pidfd,
+ EPOLLIN | EPOLLRDNORM | EPOLLHUP);
}

for (tmp = PIDTYPE_MAX; --tmp >= 0; )