Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2007 18:25:50 +0100
From:      Bjorn Gronvall <bg@sics.se>
To:        Adam McDougall <mcdouga9@egr.msu.edu>
Cc:        tss@iki.fi, freebsd-current@freebsd.org, bg@sics.se
Subject:   Re: link() not increasing link count on NFS server
Message-ID:  <20071126182550.626fac9b@ibook.sics.se>
In-Reply-To: <20071115074247.GQ37473@egr.msu.edu>
References:  <20071115074247.GQ37473@egr.msu.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 15 Nov 2007 02:42:48 -0500
Adam McDougall <mcdouga9@egr.msu.edu> wrote:

Moi,

> Hi, lately I've been trying to work out some NFS multiple access issues r=
elating=20
> to the Dovecot IMAP server software.  One symptom seems to be an unusual =
behavior=20
> of FreeBSD NFS clients that I cannot reproduce with Linux or Solaris NFS =
clients. =20
> Basically, Timo (cc'ed) came up with a small test case that seems to indi=
cate=20
> sometimes a link() call can succeed while the link count of the file will=
 not=20
> 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.

=46rom 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

--=20
  _     _                                           ,_______________.
Bjorn Gronvall (Bj=F6rn Gr=F6nvall)                    /_______________/|
Swedish Institute of Computer Science              |               ||
PO Box 1263, S-164 29 Kista, Sweden                | Schroedingers ||
Email: bg@sics.se, Phone +46 -8 633 15 25          |      Cat      |/
Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30   '---------------'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071126182550.626fac9b>