Skip to content

virtiofs: Fix couple of deadlocks

Vivek Goyal linux-fsdevel virtio-fs virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5virtiofs: Do not end request in submission contextfs/fuse/virtio_fs.c+34 -43 replies
2/5virtiofs: No need to check fpq->connected statefs/fuse/virtio_fs.c+0 -70 replies
3/5virtiofs: Set FR_SENT flag only after request has been sentfs/fuse/virtio_fs.c+10 -130 replies
4/5virtiofs: Count pending forgets as in_flight forgetsfs/fuse/virtio_fs.c+20 -240 replies
5/5virtiofs: Retry request submission from worker contextfs/fuse/virtio_fs.c+50 -92 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] virtiofs: Fix couple of deadlocks

Hi,

We have couple of places which can result in deadlock. This patch series fixes these.

We can be called with fc->bg_lock (for background requests) while submitting a request. This leads to two constraints.

- We can't end requests in submitter's context and call fuse_end_request() as it tries to take fc->bg_lock as well. So queue these requests on a list and use a worker to end these requests.

- If virtqueue is full, we can wait with fc->bg_lock held for queue to have space. Worker which is completing the request gets blocked on fc->bg_lock as well. And that means requests are not completing, that means descriptors are not being freed and that means submitter can't make progress. Deadlock.

Fix this by punting the requests to a list and retry submission later with the help of a worker.

Thanks
Vivek

Vivek Goyal (5):
virtiofs: Do not end request in submission context
virtiofs: No need to check fpq->connected state
virtiofs: Set FR_SENT flag only after request has been sent
virtiofs: Count pending forgets as in_flight forgets
virtiofs: Retry request submission from worker context

 fs/fuse/virtio_fs.c | 165 +++++++++++++++++++++++++++++---------------
 1 file changed, 111 insertions(+), 54 deletions(-)
Signature · 1 line
2.20.1