From: Peter Staubach <staubach@redhat.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Edward Hibbert <Edward.Hibbert@dataconnection.com>,
nfs@lists.sourceforge.net
Subject: Re: Rename window
Date: Fri, 11 Nov 2005 09:58:02 -0500 [thread overview]
Message-ID: <4374B17A.7030806@redhat.com> (raw)
In-Reply-To: <1131716316.8805.16.camel@lade.trondhjem.org>
Trond Myklebust wrote:
>On Fri, 2005-11-11 at 11:42 +0000, Edward Hibbert wrote:
>
>
>>I have noticed a atomicity problem with the handling of rename by the
>>Linux NFS client, and just wanted to check if this is something that
>>we just have to work-around, or is there some other solution.
>>
>>The problem arises when two different machines issue a file rename
>>which is identical.
>>
>>E.g. rename oldname newname
>>
>>You would expect that one machine would be successful, and the other
>>would fail. However, the NFS client seems to be issuing 3 NFS
>>operations to perform the rename
>> * LOOKUP oldname
>> * LOOKUP newname
>> * RENAME oldname newname
>>There is a timing window where both LOOKUPs can succeed (if the other
>>machine does the rename at the right time). In this case, the Linux
>>NFS client does not issue the final NFS RENAME operation - BUT still
>>returns success to the caller.
>>
>>Thus both machines have succeeded in renaming the file.
>>
>>You might argue that since they are performing the same operation that
>>it is OK for both to succeed, but I have an application that depends
>>on the atomicity of the operation, as it uses the filename to hold a
>>counter, and rename to assign a unique counter to a process.
>>
>>
>
>This is another of those cases where the VFS has optimised for local
>filesystem behaviour, and where fixing this problem would require
>significant VFS changes.
>You'd basically have to add a new lookup intent for the RENAME function
>in order to tell the NFS layer that it can ignore the lookup requests.
>We probably will get round to doing that sometime, but it is not one of
>the most pressing bugs on my list.
>
>In the meantime, I'd suggest just not relying on this level of atomicity
>(there are in any case situations where this is always impossible - for
>instance in sillyrename() situations).
>
It is true that rename(2) is supposed to be atomic.
It is also true that this is a problem in an optimization in the file system
independent layer in the current Linux. There is a check which compares the
"from" inode and the "to" inode and, if they are the same, just returns no
error, ie. success. NFS does need at least the lookup on the "to" name so
that it can handle the rename to an open file case.
Couldn't this be (fairly) easily handled by making the short circuit check
in vfs_rename() conditional and not use it for NFS mounted file systems
and perhaps others?
Thanx...
ps
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2005-11-11 14:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-11 11:42 Rename window Edward Hibbert
2005-11-11 13:30 ` Neil Horman
2005-11-11 13:41 ` Trond Myklebust
2005-11-11 13:38 ` Trond Myklebust
2005-11-11 14:58 ` Peter Staubach [this message]
2005-11-11 15:13 ` Trond Myklebust
2005-11-11 15:25 ` Peter Staubach
-- strict thread matches above, loose matches on Subject: below --
2005-11-11 15:28 Edward Hibbert
2005-11-11 15:29 ` Trond Myklebust
2005-11-11 15:33 ` Peter Staubach
2005-11-11 15:31 Edward Hibbert
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=4374B17A.7030806@redhat.com \
--to=staubach@redhat.com \
--cc=Edward.Hibbert@dataconnection.com \
--cc=nfs@lists.sourceforge.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.