Skip to content

virtiofs: hiprio FORGET robustness and no-reply request completion

Li Wang linux-fsdevel lkml virtualization 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 2 repliesIn review

Changes in v2 from the cover letter

------------------------------
Patch 1: v1 only guarded copy_args_from_argbuf() with FR_ISREPLY. v2 also kfree(req->argbuf) when !FR_ISREPLY (the buffer was allocated in copy_args_to_argbuf for an out header that never arrives), and gates virtio_fs_verify_response() in virtio_fs_requests_done_work() on FR_ISREPLY so uninitialized fuse_out_header is never verified.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3virtiofs: Complete no-reply virtio requests without parsing the out headerfs/fuse/virtio_fs.c+12 -40 replies
2/3virtiofs: Retry hiprio FORGET when virtqueue_add_outbuf() returns -ENOMEMfs/fuse/virtio_fs.c+4 -40 replies
3/3virtiofs: Do not stall hiprio FORGET dispatch after dropping one requestfs/fuse/virtio_fs.c+6 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/3] virtiofs: hiprio FORGET robustness and no-reply request completion

This series fixes virtiofs completion for FUSE requests that do not use a reply descriptor, tightens hiprio FORGET handling when virtqueue submission fails transiently, and prevents the hiprio worker from stalling when one FORGET must be dropped after an unrecoverable error.

The first patch addresses correctness: completing a no-reply request must not interpret the reply header fields, otherwise it will cause underflow, and the bounce buffer allocated for the absent out header must be freed.

The host may complete virtio requests without an out descriptor (e.g. FUSE_FORGET). The completion path must not run copy_args_from_argbuf(), which expects a valid fuse_out_header from the reply path. This series also ensures virtio_fs_verify_response() runs only for real replies (FR_ISREPLY), and frees req->argbuf on the no-reply path to avoid a per-request leak.

Changes since v1
------------------------------
Patch 1: v1 only guarded copy_args_from_argbuf() with FR_ISREPLY. v2 also kfree(req->argbuf) when !FR_ISREPLY (the buffer was allocated in copy_args_to_argbuf for an out header that never arrives), and gates virtio_fs_verify_response() in virtio_fs_requests_done_work() on FR_ISREPLY so uninitialized fuse_out_header is never verified.

Patch 2: behavior matches v1. The commit message is expanded to explain transient GFP_ATOMIC exhaustion and why dropping the FORGET would skew nlookup and leak kernel state.

Patch 3: behavior matches v1. The commit message documents the return-value contract with virtio_fs_hiprio_dispatch_work() and the stall risk on the nonzero path.

Commit messages were rewritten for clearer rationale.

Li Wang (3):
virtiofs: Complete no-reply virtio requests without parsing the out
header
virtiofs: Retry hiprio FORGET when virtqueue_add_outbuf() returns
-ENOMEM
virtiofs: Do not stall hiprio FORGET dispatch after dropping one
request

 fs/fuse/virtio_fs.c | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1