public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Charles Duffy <charles@dyfis.net>
To: linux-nfs@vger.kernel.org
Subject: Apparent race condition w/ NFSv3 mktemp+write+rename
Date: Tue, 24 Nov 2009 13:26:44 -0600	[thread overview]
Message-ID: <hehc8g$k8f$1@ger.gmane.org> (raw)

Howdy. With a very heavily loaded (CentOS 5 - Linux 2.6.18-128.el5) 
NFSv3 client and server, I've experienced the following sporadic issue:

function atomic_write() {
     local filename="$1"
     local tempfile
     tempfile="$(mktemp "${filename}.XXXXXX")"
     cat >"${tempfile}" && mv "${tempfile}" "${filename}"
}

$ atomic_write /mnt/foobar <<<"baz"
mv: cannot move `/mnt/foobar.gO1881' to `/mnt/foobar': No such file or 
directory

Are my assumptions regarding available semantics fair and reasonable?


             reply	other threads:[~2009-11-24 19:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 19:26 Charles Duffy [this message]
2009-11-24 20:03 ` Apparent race condition w/ NFSv3 mktemp+write+rename Jeff Layton
2009-11-24 20:04   ` Jeff Layton
2009-11-24 20:03 ` Peter Staubach
2009-11-24 20:24   ` Charles Duffy
     [not found]     ` <4B0C4116.10903-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org>
2009-11-24 20:30       ` Peter Staubach
2009-11-24 20:36         ` Charles Duffy
     [not found]           ` <4B0C43D5.7000103-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org>
2009-11-24 20:44             ` Peter Staubach

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='hehc8g$k8f$1@ger.gmane.org' \
    --to=charles@dyfis.net \
    --cc=linux-nfs@vger.kernel.org \
    /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