Skip to content

Commit 3542d8f

Browse files
committed
fuse: fix io_uring connection abort leaving requests stuck
Fix uninterruptible sleep (D state) hangs during FUSE filesystem teardown when using io_uring. The issue manifests as processes stuck waiting for requests that are never completed, particularly affecting force requests like FUSE_FLUSH or when requests are created after fuse_abort_conn() already finished. If on daemon exit io_uring_try_cancel_requests() runs and calls fuse_uring_cancel() which will teardown the entries by calling fuse_uring_entry_teardown() before fuse_abort_conn() then we end up in fuse_uring_abort with queue_refs == 0 and the queues are never stopped. If the queues are stopped all new requests will be rejected, but that does not happen, so all new calls are stuck. Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com> (cherry picked from commit 9550b4d)
1 parent c645e54 commit 3542d8f

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

fs/fuse/dev_uring.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,10 @@ void fuse_uring_flush_bg(struct fuse_conn *fc)
157157
if (!queue)
158158
continue;
159159

160-
queue->stopped = true;
161-
162160
WARN_ON_ONCE(ring->fc->max_background != UINT_MAX);
163161
spin_lock(&queue->lock);
164162
spin_lock(&fc->bg_lock);
163+
queue->stopped = true;
165164
fuse_uring_flush_queue_bg(queue);
166165
spin_unlock(&fc->bg_lock);
167166
spin_unlock(&queue->lock);

fs/fuse/dev_uring_i.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ static inline void fuse_uring_abort(struct fuse_conn *fc)
178178
if (ring == NULL)
179179
return;
180180

181-
if (atomic_read(&ring->queue_refs) > 0) {
182-
fuse_uring_flush_bg(fc);
183-
fuse_uring_stop_queues(ring);
184-
}
181+
fuse_uring_flush_bg(fc);
182+
fuse_uring_stop_queues(ring);
185183
}
186184

187185
static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc)

0 commit comments

Comments
 (0)