Re: [PATCH] zerocopy NFS updated

From: David S. Miller (davem@redhat.com)
Date: Thu Apr 11 2002 - 01:48:21 EST


   From: Hirokazu Takahashi <taka@valinux.co.jp>
   Date: Thu, 11 Apr 2002 15:46:51 +0900 (JST)

   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/



This archive was generated by hypermail 2b29 : Mon Apr 15 2002 - 22:00:18 EST