On Fri, Jan 10, 2014 at 8:10 AM, Peter Lieven <p...@kamp.de> wrote: > > Ronnie, can you also give a short advise on Kevin's question about short > reads. > I think they can happen if we read beyond past EOF or not? >
Short reads should normally not happen in libnfs itself since servers are often careful always trying to sending back as much data as the client requested. There is a common exception though, for the case where you read past the end of file. So short reads should normally not happen. Unless QEMU or the guest sends a request to libnfs to read past the end of the file. If you send a READ for 1024 bytes to an nfs server at the offset 512 bytes from the end-of-file then the server will respond with a read reply containing 512 bytes of data (and the eof flag set in the reply). In my experience, most kernel/os based clients seem to be very careful to never try to read beyond enf of file, so this rarely happens in normal nfs. (I only recall HPUX being a system where it would be common to always issue nfs i/o in multiples of 4k so for those clients it was very important to make sure you implement short reads correctly in the server). I don't know how careful QEMU is in trying to prevent reading past the end of the device or if it enforces it if the guest tries. It is probably worth checking for short reads, at least for the case where you might be reading past end of file.