Re: link() not increasing link count on NFS server

From: Bjorn Gronvall <bg_at_sics.se>
Date: Mon, 26 Nov 2007 18:25:50 +0100
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   '---------------'
Received on Mon Nov 26 2007 - 16:26:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:23 UTC