From owner-freebsd-current@FreeBSD.ORG Thu Nov 15 14:46:32 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 89E9416A417; Thu, 15 Nov 2007 14:46:32 +0000 (UTC) (envelope-from tss@iki.fi) Received: from dovecot.org (dovecot.org [82.118.211.50]) by mx1.freebsd.org (Postfix) with ESMTP id 0857613C43E; Thu, 15 Nov 2007 14:46:31 +0000 (UTC) (envelope-from tss@iki.fi) Received: from [192.168.10.217] (82-203-162-146.dsl.gohome.fi [82.203.162.146]) by dovecot.org (Postfix) with ESMTP id ABB3916471F1; Thu, 15 Nov 2007 16:45:58 +0200 (EET) In-Reply-To: <20071115135734.O82897@fledge.watson.org> References: <20071115074247.GQ37473@egr.msu.edu> <20071115123543.H82897@fledge.watson.org> <1195132320.6039.135.camel@hurina> <20071115135734.O82897@fledge.watson.org> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-11--65060986" Message-Id: <51176178-A34C-4BCB-9929-B878AD6AA382@iki.fi> Content-Transfer-Encoding: 7bit From: Timo Sirainen Date: Thu, 15 Nov 2007 16:46:27 +0200 To: Robert Watson X-Pgp-Agent: GPGMail 1.1.2 (Tiger) X-Mailer: Apple Mail (2.752.2) X-Mailman-Approved-At: Thu, 15 Nov 2007 14:52:11 +0000 Cc: Adam McDougall , freebsd-current@FreeBSD.org, mohans@FreeBSD.org 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: Thu, 15 Nov 2007 14:46:32 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-11--65060986 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 15.11.2007, at 16.05, Robert Watson wrote: > Indeed, and inspection of nfs_vnops.c:nfs_link(): finds: > > 1772 /* > 1773 * Kludge: Map EEXIST => 0 assuming that it is a reply > to a retry. > 1774 */ > 1775 if (error == EEXIST) > 1776 error = 0; > 1777 return (error); > > Neither Linux nor Solaris appears to have this logic in the > client. I assume this is, as suggested, to work around UDP > retransmissions where the reply is lost rather than the request. > It appears to exist in revision 1.1 of nfs_vnops.c, so came in with > 4.4BSD in the initial import, but doesn't appear in NetBSD so I'm > guessing they've removed it. It could well be we should be doing > the same. I've added Mohan to the CC line in case he has any input > on this point. A couple of arguments for its removal: It's somewhat well known that link() can fail with EEXIST even though it had succeeded (e.g. link(2) man page in Linux mentions it), but I hadn't before heard that link() could return success even though it failed. Since link() is often used for creating lock files, it's a lot safer to fail occationally than to think that the locking succeeded and cause data corruption. I've anyway changed my code to work around both problems now (return 0 check in #ifdef __FreeBSD__). BTW. Another problem I have is that it seems the only way to make sure open() opens the latest file with the given name is to rmdir() its parent directory. This isn't very nice to do for directories that might be empty, so could the code be changed to flush the cache also when chown()ing the directory or something? --Apple-Mail-11--65060986 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iD8DBQFHPFvKyUhSUUBViskRAuGVAJ0b5iLO2asaxepEGGGnFU4aQZjBcACgi7/v yw5hI4353gkXVyEiZx9pEQs= =XU9k -----END PGP SIGNATURE----- --Apple-Mail-11--65060986--