Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Nov 2007 16:46:27 +0200
From:      Timo Sirainen <tss@iki.fi>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        Adam McDougall <mcdouga9@egr.msu.edu>, freebsd-current@FreeBSD.org, mohans@FreeBSD.org
Subject:   Re: link() not increasing link count on NFS server
Message-ID:  <51176178-A34C-4BCB-9929-B878AD6AA382@iki.fi>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51176178-A34C-4BCB-9929-B878AD6AA382>