public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Kirby <sim@netnation.com>
To: linux-kernel@vger.kernel.org,
	Trond Myklebust <trond.myklebust@fys.uio.no>
Subject: NFS client behavior on close
Date: Mon, 31 May 2004 14:38:21 -0700	[thread overview]
Message-ID: <20040531213820.GA32572@netnation.com> (raw)

'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-

             reply	other threads:[~2004-05-31 21:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-31 21:38 Simon Kirby [this message]
2004-06-02  6:55 ` NFS client behavior on close Trond Myklebust
2004-06-02 15:41   ` Simon Kirby
2004-06-02 16:38     ` Trond Myklebust
2004-06-02 19:16       ` Simon Kirby
2004-06-02 19:45         ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040531213820.GA32572@netnation.com \
    --to=sim@netnation.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox