Linux v9fs does not support streaming reads from synthetic 9P filesystems.

When a synthetic file (e.g. an LLM output stream) blocks on Tread and returns 
data incrementally via short reads, Linux v9fs treats short reads as near-EOF 
and/or gates reads on i_size, causing `cat` to return the entire output in one 
block instead of streaming.
Plan 9 handles this correctly:
cat(1) loops on read(2), the kernel issues Tread, the server blocks until data 
is available, returns a short read, and cat prints it immediately.
On Linux, two things break this:
1. netfs_unbuffered_read_iter() and the underlying netfs DIO path treat short 
reads (submitted < len) as errors (EIO) rather than partial success.
2. The generic VFS read path consults i_size (from Rstat) to decide whether 
there is anything to read. Synthetic files often report i_size=0 because their 
content is generated on demand.


Inside netfs_unbuffered_read() (in fs/netfs/direct_read.c), after dispatching 
the read and waiting:


if (ret == 0 && rreq->submitted < rreq->len && rreq->origin != NETFS_DIO_READ)
{
      trace_netfs_failure(rreq, NULL, ret, netfs_fail_short_read); ret = -EIO; 
// ← THIS KILLS STREAMING
}


The netfs library was written for AFS/CIFS/NFS where a short read means 
corruption, not "data is still being generated."


What do you guys think ? Am I missing something ?
------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T52da395428d9d9c7-Mc329e0b523b0d2d5a612ba21
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to