* Apparent race condition w/ NFSv3 mktemp+write+rename
@ 2009-11-24 19:26 Charles Duffy
2009-11-24 20:03 ` Jeff Layton
2009-11-24 20:03 ` Peter Staubach
0 siblings, 2 replies; 8+ messages in thread
From: Charles Duffy @ 2009-11-24 19:26 UTC (permalink / raw)
To: linux-nfs
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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
2009-11-24 19:26 Apparent race condition w/ NFSv3 mktemp+write+rename Charles Duffy
@ 2009-11-24 20:03 ` Jeff Layton
2009-11-24 20:04 ` Jeff Layton
2009-11-24 20:03 ` Peter Staubach
1 sibling, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2009-11-24 20:03 UTC (permalink / raw)
To: Charles Duffy; +Cc: linux-nfs
On Tue, 24 Nov 2009 13:26:44 -0600
Charles Duffy <charles-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org> wrote:
> 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?
>
Known problem with O_EXCL creates. Fixed in RHEL fairly recently. You
probably want a newer kernel.
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
2009-11-24 19:26 Apparent race condition w/ NFSv3 mktemp+write+rename Charles Duffy
2009-11-24 20:03 ` Jeff Layton
@ 2009-11-24 20:03 ` Peter Staubach
2009-11-24 20:24 ` Charles Duffy
1 sibling, 1 reply; 8+ messages in thread
From: Peter Staubach @ 2009-11-24 20:03 UTC (permalink / raw)
To: Charles Duffy; +Cc: linux-nfs
Charles Duffy wrote:
> 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?
>
At the end, does /mnt/foobar exist and contain the string, "baz"?
What mount options are being used on the client?
It sounds to me as if the duplicate request cache on the server
is not working, perhaps because entries are being recycled too
quickly, and does not catch a retransmitted RENAME operation.
Thanx...
ps
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
2009-11-24 20:03 ` Jeff Layton
@ 2009-11-24 20:04 ` Jeff Layton
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Layton @ 2009-11-24 20:04 UTC (permalink / raw)
To: Jeff Layton; +Cc: Charles Duffy, linux-nfs
On Tue, 24 Nov 2009 15:03:01 -0500
Jeff Layton <jlayton@redhat.com> wrote:
> On Tue, 24 Nov 2009 13:26:44 -0600
> Charles Duffy <charles@dyfis.net> wrote:
>
> > 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?
> >
>
> Known problem with O_EXCL creates. Fixed in RHEL fairly recently. You
> probably want a newer kernel.
>
My mistake...I didn't read the version closely enough. I was thinking
of another issue. I'm not sure if a newer kernel will help you.
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
2009-11-24 20:03 ` Peter Staubach
@ 2009-11-24 20:24 ` Charles Duffy
[not found] ` <4B0C4116.10903-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Charles Duffy @ 2009-11-24 20:24 UTC (permalink / raw)
To: Peter Staubach; +Cc: linux-nfs
Peter Staubach wrote:
> At the end, does /mnt/foobar exist and contain the string, "baz"?
>
I'll follow up with that information with that after the issue is next
reproduced. (The mv operation is replacing a prior instance of
/mnt/foobar, so content will need to be inspected to determine whether
it was successful).
> What mount options are being used on the client?
>
rw,vers=3,rsize=32768,wsize=32768,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=<redacted>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
[not found] ` <4B0C4116.10903-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org>
@ 2009-11-24 20:30 ` Peter Staubach
2009-11-24 20:36 ` Charles Duffy
0 siblings, 1 reply; 8+ messages in thread
From: Peter Staubach @ 2009-11-24 20:30 UTC (permalink / raw)
To: Charles Duffy; +Cc: linux-nfs
Charles Duffy wrote:
> Peter Staubach wrote:
>> At the end, does /mnt/foobar exist and contain the string, "baz"?
>>
> I'll follow up with that information with that after the issue is next
> reproduced. (The mv operation is replacing a prior instance of
> /mnt/foobar, so content will need to be inspected to determine whether
> it was successful).
>
>> What mount options are being used on the client?
>>
> rw,vers=3,rsize=32768,wsize=32768,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=<redacted>
>
Hmmm. This appears to be the defaults.
Does this take a very long time to run when it fails like this?
Thanx...
ps
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
2009-11-24 20:30 ` Peter Staubach
@ 2009-11-24 20:36 ` Charles Duffy
[not found] ` <4B0C43D5.7000103-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Charles Duffy @ 2009-11-24 20:36 UTC (permalink / raw)
To: Peter Staubach; +Cc: linux-nfs
Peter Staubach wrote:
> Does this take a very long time to run when it fails like this?
>
Total runtime for script invocations where the failure occurred has in
all cases (two today -- one at 7:59AM, the other at 12:08PM) been less
than three seconds.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Apparent race condition w/ NFSv3 mktemp+write+rename
[not found] ` <4B0C43D5.7000103-7s4ginpmXnFeoWH0uzbU5w@public.gmane.org>
@ 2009-11-24 20:44 ` Peter Staubach
0 siblings, 0 replies; 8+ messages in thread
From: Peter Staubach @ 2009-11-24 20:44 UTC (permalink / raw)
To: Charles Duffy; +Cc: linux-nfs
Charles Duffy wrote:
> Peter Staubach wrote:
>> Does this take a very long time to run when it fails like this?
>>
> Total runtime for script invocations where the failure occurred has in
> all cases (two today -- one at 7:59AM, the other at 12:08PM) been less
> than three seconds.
Interesting. And non-deterministic, I'll bet?
Thanx...
ps
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-11-24 20:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 19:26 Apparent race condition w/ NFSv3 mktemp+write+rename Charles Duffy
2009-11-24 20:03 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox