NFS client behavior on close

From: Simon Kirby (sim_at_netnation.com)
Date: 05/31/04


Date:	Mon, 31 May 2004 14:38:21 -0700
To: linux-kernel@vger.kernel.org, Trond Myklebust <trond.myklebust@fys.uio.no>


'lo,

I have a simple script which downloads pictures from my camera's flash
card and writes them to the current directory, which is often on an NFS
mount to a box with available HD space.

I noticed that with files of about this size (~5 MB), there seems to be a
lot of blocking with "cp" (or "mv"), noted by the LED on the card reader
being idle between each file. What seems to be happening is that "cp"
will open() the source and destination, read and write a bunch of times,
and then close() the destination and source. An "strace -r" reveals that
on the close() of the destination, "cp" blocks for quite a while.
Looking at the network, it appears this is happening:

- cp starts copying, data goes to dirty cache (not yet to NFS server)
- cp closes destination
- cp blocks while NFS client writes dirty cache to NFS server
- cp wakes back up when NFS has written all data
- cp proceeds to the next file

This is quite suboptimal in that while the file is being read from the
(relatively slow) compact flash reader it has not yet started writing
over the network, and then between each file it writes all data.

Is the NFS client required to write all data on close? If I mount with
"noac", downloads are actually faster because each block is written
immediately and there's nothing to unclog on close(). However, with this
option all other bulk transfers are slower (the network never saturates).

I'm using NFSv3. Would NFSv4 or another version behave differently here?

2.6.6 server and client, btw. Server exported "async", though exported
with "sync" appears equivalent to the client.

...
     0.000073 read(3, "\f\0\322\0z\0\200\0\r\0\n\0"..., 4096) = 800
     0.000065 write(4, "\f\0\322\0z\0\200\0\r\0\n\0"..., 800) = 800
     0.000066 read(3, "", 4096) = 0
     0.000055 close(4) = 0
     0.906548 close(3) = 0

Thanks,

Simon-
-
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/



Relevant Pages

  • Re: NFS problems with FC2
    ... The machine is an NFS client but can't connect to my NFS ... Alas the client machine I'm typing this on is a dual boot ... On the nfs server I get the error: ...
    (linux.redhat.install)
  • Re: Basic file sharing
    ... That way you can mount anything anywhere. ... The NFS server is the directories you share. ... The NFS client is ...
    (alt.os.linux.suse)
  • Summary: Sun Solaris and HP-UX nfs problem
    ... To All Helpers: ... The HP is a nfs server and Solaris 2.8 is nfs client. ...
    (SunManagers)
  • Poor NFS performance between 2 Linux boxes
    ... I am having some weird performance problems with NFS under Linux. ... options for the exported filesystem: ... The problem is that even though the NFS server and the NFS client are ...
    (comp.os.linux.networking)
  • NFS negative dentry caching problem in 2.4.21, and patch
    ... Below is a description of the problem and a suggested patch. ... Hat support request, so when it says "RHEL3", think "Linux 2.4.21". ... We have a big problem with how the NFS client code in RHEL3 ... from an NFS server (doesn't matter what kind, ...
    (Linux-Kernel)