[PATCH v5 1/2] ceph: wake up i_cap_wq waiters on inode shutdown

From: Xiubo Li via B4 Relay

Date: Tue Aug 25 2026 - 08:11:05 EST


From: Xiubo Li <xiubo.li@xxxxxxxxx>

ceph_inode_shutdown() purges every cap on the inode but never wakes
i_cap_wq, unlike remove_session_caps_cb() which does so after the same
kind of purge. Anyone blocked in ceph_get_caps() is waiting on that
queue for caps that are now gone for good, so the wait only ends when
the task is killed.

Wake the queue after purging so the waiters get a chance to notice the
shutdown and bail out.

Link: https://tracker.ceph.com/issues/77594
Signed-off-by: Xiubo Li <xiubo.li@xxxxxxxxx>
---
fs/ceph/inode.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 22c7da1ea61c..888df696397a 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -3250,6 +3250,13 @@ void ceph_inode_shutdown(struct inode *inode)
}
spin_unlock(&ci->i_ceph_lock);

+ /*
+ * The caps are gone now, so wake up anyone waiting for them -- they
+ * are never coming back and the waiters need to notice the shutdown
+ * instead. remove_session_caps_cb() does the same after purging.
+ */
+ wake_up_all(&ci->i_cap_wq);
+
if (invalidate)
ceph_queue_invalidate(inode);
while (iputs--)

--
2.53.0