Please consider a knfsd sends data of File A by useing sendmsg().
1. The knfsd copies the data of File A into sk_buff.
2. File A may be truncated after step.1
3. NFS clients receives the packets of File A which is already truncated.
Next please consider the knfsd sends data of File A by useing sendpage().
1. The knfsd grabs pages of File A. (page_cache_get)
2. File A may be truncated after step.1
3. The knfsd send the pages.
4. NFS clients receives the packets of File A which is already truncated.
Is there any differences between them ?
This behavior is invisible to NFS Clients, I think.
Consider truncate() to 1 byte left in that page. To handle mmap()'s
of this file the kernel will memset() rest of the page to zero.
Now, in the sendfile() case the NFS client sees some page filled
mostly of zeros instead of file contents.
In sendmsg() knfd case, client sees something reasonable. He will
see something that was actually in the file at some point in time.
The sendfile() case sees pure garbage, contents that never were in
the file at any point in time.
We could make knfsd take the write semaphore on the inode until client
is known to get the packet but that is the kind of overhead we'd like
to avoid.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/