Re: [PATCH] 9p: treat read return values of 0 as EOF

From: Barret Rhoden

Date: Mon Jul 27 2026 - 13:42:43 EST


On 7/13/26 5:29 AM, David Howells wrote:
This is kind of a weird situation. We're caching locally the content of files
aren't really regular files and probably shouldn't be cached. I'm not sure
what the best way to deal with that is. I wonder if there's some way to
detect that and mark then non-cacheable. (Assuming the server can be told not
to even serve them).

Can we detect that the EOF length doesn't match i_size and set a flag to say
"don't cache" in netfs_inode::flags?
Possibly, but could you have false positives from this? e.g. if a file's size is changed concurrently with a read returning EOF?

As far as detecting EOF in the first place, my patch had the 9p client doing it. Not sure, but Dominique's question might have been whether netfs should have done the detecting instead?

From what I can see, the netfs clients were responsible for setting EOF (except in netfs_clear_unread()). Some in response to an ENODATA error, others due to the "did we read past the end of the file size." Not sure whose responsibility it is to detect these cases: netfs or the FSes themselves.

Thanks,
Barret