On Mon, Apr 06, 2020 at 10:04:11AM -0700, Linus Torvalds wrote: > On Mon, Apr 6, 2020 at 9:46 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > > > POSIX may well "allow" short reads, but userspace programmers basically > > never check the return value from read(). Short reads aren't actually > > allowed. That's why signals are only allowed to interrupt syscalls if > > they're fatal (and the application will never see the returned value > > because it's already dead). > > Well, that's true for some applications. > > But look at anybody who ever worked more with NFS mounts, and they got > used to having the 'intr' mount flag set and incomplete reads and > -EAGAIN as a result. That's why you had me implement TASK_KILLABLE ;-) > Are there apps that react badly? I'm sure - but they also wouldn't > have O_NONBLOCK set on a regular file. The only reason to set > O_NONBLOCK is because you think the fd might be a pipe or something, > and you _are_ ready to get partial reads. > > So the 9p behavior certainly isn't outrageously out of line for a > network filesystem. In fact, because of O_NONBLOCK rather than a mount > option, I think it's a lot safer than a fairly standard NFS option. The NFS option has been a no-op for over a decade ;-) I agree with you that O_NONBLOCK is a good indicator the application is willing to handle short reads (or indeed writes).