server: do not reject oversized readdir requests

The FUSE READDIR and READDIRPLUS size field describes the maximum number of bytes the server may return. Returning fewer bytes is valid.

virtiofsd currently treats a size larger than MAX_BUFFER_SIZE as an error and returns ENOMEM. A guest can legitimately offer a larger output buffer when the negotiated max_pages value is converted using a larger guest page size than the host page size used by virtiofsd to compute max_pages.

Limit the amount of directory data generated locally to MAX_BUFFER_SIZE instead of rejecting the request. The existing available-bytes check still verifies that the output buffer can hold the bounded response.

Signed-off-by: Matthew R. Ochs mochs@nvidia.com

Merge request reports

Loading