Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: wake poll waiters when an empty pipe is unlinked
@ 2026-10-20  7:14 Avi Weiss
  2026-10-20  8:52 ` NeilBrown
  2026-10-20 10:52 ` Jeff Layton
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Weiss @ 2026-10-20  7:14 UTC (permalink / raw)
  To: Trond Myklebust, Chuck Lever
  Cc: Anna Schumaker, Jeff Layton, NeilBrown, linux-nfs

When an empty rpc_pipefs pipe is unlinked, rpc_purge_list() returns
without waking the pipe wait queue. An existing epoll waiter can
remain blocked even though rpc_pipe_poll() reports EPOLLHUP and
EPOLLERR for the disconnected pipe.

Wake the wait queue after clearing RPC_I(inode)->pipe so existing
poll waiters are notified regardless of whether messages were purged.

Fixes: 9842ef3557ab ("SUNRPC: rpc_timeout_upcall_queue should not sleep")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---

Tested with an empty rpc_pipefs pipe in QEMU:
- 7.3.0 baseline: fresh poll() reports HUP/ERR (0x18),
  but an existing epoll_wait() times out.
- 7.3.0 with this patch: fresh poll() reports HUP/ERR (0x18),
  and epoll_wait() returns events=0x18.

 net/sunrpc/rpc_pipe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 9d349cfbc4831..68b4e040a77d9 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -191,6 +191,7 @@ rpc_close_pipes(struct dentry *dentry)
 	cancel_delayed_work_sync(&pipe->queue_timeout);
 	rpc_inode_setowner(inode, NULL);
 	RPC_I(inode)->pipe = NULL;
+	wake_up(&RPC_I(inode)->waitq);
 	inode_unlock(inode);
 }
 

base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] SUNRPC: wake poll waiters when an empty pipe is unlinked
  2026-10-20  7:14 [PATCH] SUNRPC: wake poll waiters when an empty pipe is unlinked Avi Weiss
@ 2026-10-20  8:52 ` NeilBrown
  2026-10-20 10:52 ` Jeff Layton
  1 sibling, 0 replies; 3+ messages in thread
From: NeilBrown @ 2026-10-20  8:52 UTC (permalink / raw)
  To: Avi Weiss
  Cc: Trond Myklebust, Chuck Lever, Anna Schumaker, Jeff Layton,
	linux-nfs

On Tue, 20 Oct 2026, Avi Weiss wrote:
> When an empty rpc_pipefs pipe is unlinked, rpc_purge_list() returns
> without waking the pipe wait queue. An existing epoll waiter can
> remain blocked even though rpc_pipe_poll() reports EPOLLHUP and
> EPOLLERR for the disconnected pipe.
> 
> Wake the wait queue after clearing RPC_I(inode)->pipe so existing
> poll waiters are notified regardless of whether messages were purged.

The wake doesn't strictly need to be *after* clearing ->pipe, only
before unlocking the inode.  But after clearing is a good place to put
it.

Reviewed-by: NeilBrown <neil@brown.name>

Thanks,
NeilBrown


> 
> Fixes: 9842ef3557ab ("SUNRPC: rpc_timeout_upcall_queue should not sleep")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---
> 
> Tested with an empty rpc_pipefs pipe in QEMU:
> - 7.3.0 baseline: fresh poll() reports HUP/ERR (0x18),
>   but an existing epoll_wait() times out.
> - 7.3.0 with this patch: fresh poll() reports HUP/ERR (0x18),
>   and epoll_wait() returns events=0x18.
> 
>  net/sunrpc/rpc_pipe.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
> index 9d349cfbc4831..68b4e040a77d9 100644
> --- a/net/sunrpc/rpc_pipe.c
> +++ b/net/sunrpc/rpc_pipe.c
> @@ -191,6 +191,7 @@ rpc_close_pipes(struct dentry *dentry)
>  	cancel_delayed_work_sync(&pipe->queue_timeout);
>  	rpc_inode_setowner(inode, NULL);
>  	RPC_I(inode)->pipe = NULL;
> +	wake_up(&RPC_I(inode)->waitq);
>  	inode_unlock(inode);
>  }
>  
> 
> base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
> -- 
> 2.43.0
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] SUNRPC: wake poll waiters when an empty pipe is unlinked
  2026-10-20  7:14 [PATCH] SUNRPC: wake poll waiters when an empty pipe is unlinked Avi Weiss
  2026-10-20  8:52 ` NeilBrown
@ 2026-10-20 10:52 ` Jeff Layton
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2026-10-20 10:52 UTC (permalink / raw)
  To: Avi Weiss, Trond Myklebust, Chuck Lever
  Cc: Anna Schumaker, NeilBrown, linux-nfs

On Tue, 2026-10-20 at 10:14 +0300, Avi Weiss wrote:
> When an empty rpc_pipefs pipe is unlinked, rpc_purge_list() returns
> without waking the pipe wait queue. An existing epoll waiter can
> remain blocked even though rpc_pipe_poll() reports EPOLLHUP and
> EPOLLERR for the disconnected pipe.
> 
> Wake the wait queue after clearing RPC_I(inode)->pipe so existing
> poll waiters are notified regardless of whether messages were purged.
> 
> Fixes: 9842ef3557ab ("SUNRPC: rpc_timeout_upcall_queue should not sleep")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---
> 
> Tested with an empty rpc_pipefs pipe in QEMU:
> - 7.3.0 baseline: fresh poll() reports HUP/ERR (0x18),
>   but an existing epoll_wait() times out.
> - 7.3.0 with this patch: fresh poll() reports HUP/ERR (0x18),
>   and epoll_wait() returns events=0x18.
> 
>  net/sunrpc/rpc_pipe.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
> index 9d349cfbc4831..68b4e040a77d9 100644
> --- a/net/sunrpc/rpc_pipe.c
> +++ b/net/sunrpc/rpc_pipe.c
> @@ -191,6 +191,7 @@ rpc_close_pipes(struct dentry *dentry)
>  	cancel_delayed_work_sync(&pipe->queue_timeout);
>  	rpc_inode_setowner(inode, NULL);
>  	RPC_I(inode)->pipe = NULL;
> +	wake_up(&RPC_I(inode)->waitq);
>  	inode_unlock(inode);
>  }
>  
> 
> base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222

Reviewed-by: Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-20 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20  7:14 [PATCH] SUNRPC: wake poll waiters when an empty pipe is unlinked Avi Weiss
2026-10-20  8:52 ` NeilBrown
2026-10-20 10:52 ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox