From owner-freebsd-current@FreeBSD.ORG Mon Nov 26 17:26:17 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ADDA16A421 for ; Mon, 26 Nov 2007 17:26:17 +0000 (UTC) (envelope-from bg@sics.se) Received: from letter.sics.se (letter.sics.se [193.10.64.6]) by mx1.freebsd.org (Postfix) with ESMTP id C155E13C4E3 for ; Mon, 26 Nov 2007 17:26:16 +0000 (UTC) (envelope-from bg@sics.se) Received: from sics.se (ibook.sics.se [193.10.66.104]) by letter.sics.se (Postfix) with ESMTP id B5C1B400E0; Mon, 26 Nov 2007 18:26:12 +0100 (CET) Date: Mon, 26 Nov 2007 18:25:50 +0100 From: Bjorn Gronvall To: Adam McDougall Message-ID: <20071126182550.626fac9b@ibook.sics.se> In-Reply-To: <20071115074247.GQ37473@egr.msu.edu> References: <20071115074247.GQ37473@egr.msu.edu> Organization: SICS.SE X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.6; i386-portbld-freebsd6.2) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: tss@iki.fi, freebsd-current@freebsd.org, bg@sics.se Subject: Re: link() not increasing link count on NFS server X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2007 17:26:17 -0000 On Thu, 15 Nov 2007 02:42:48 -0500 Adam McDougall 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 '---------------'