link() not increasing link count on NFS server
Bjorn Gronvall
bg at sics.se
Mon Nov 26 09:26:17 PST 2007
On Thu, 15 Nov 2007 02:42:48 -0500
Adam McDougall <mcdouga9 at egr.msu.edu> wrote:
Moi,
> Hi, lately I've been trying to work out some NFS multiple access issues relating
> to the Dovecot IMAP server software. One symptom seems to be an unusual behavior
> of FreeBSD NFS clients that I cannot reproduce with Linux or Solaris NFS clients.
> Basically, Timo (cc'ed) came up with a small test case that seems to indicate
> sometimes a link() call can succeed while the link count of the file will not
> increase.
There is no foolproof way to do this over NFSv{2,3} using links,
symlinks or directories. In order to better deal with problems of this
sort NFSv3 changed the CREATE RPC to add support for an EXCLUSIVE flag
and a create verifier.
From RFC 1813, NFS Version 3 Protocol: "
CREATE
An exclusive flag and a create verifier was added for
the exclusive creation of regular files.
"
The corresponding change was never made to any of the other RPC calls.
If possible you should change Dovecot to instead create lockfiles
using open(2) with the O_EXCL flag. This way your locks will work
reliably over NFSv3 even during server reboots or long lasting network
partitions. You will still have a problem if the underlying file
system is NFSv2 and perhaps also with other filesystems.
Cheers,
/b
--
_ _ ,_______________.
Bjorn Gronvall (Björn Grönvall) /_______________/|
Swedish Institute of Computer Science | ||
PO Box 1263, S-164 29 Kista, Sweden | Schroedingers ||
Email: bg at sics.se, Phone +46 -8 633 15 25 | Cat |/
Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30 '---------------'
More information about the freebsd-current
mailing list