Subject: Re: NFSv3 & O_EXCL
To: Frank van der Linden <fvdl@vaasje.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 07/25/2000 18:59:03
On Mon, Jul 24, 2000 at 08:49:22PM +0200, Frank van der Linden wrote:
> On Mon, Jul 24, 2000 at 06:10:28PM +0200, Manuel Bouyer wrote:
> > Hi,
> > Aidan Cully pointed out the following on tech-userlevel:
> > when opening a file with O_EXCL, and using NFSv3 and the server doesn't
> > support NFSV3CREATE_EXCLUSIVE, then NetBSD will silently drop the
> > O_EXCL flag an retry the operation (code fragment from nfs_vnops,, around
> > line 1383, in nfs_create():
> > if (v3 && (fmode & O_EXCL) && error == NFSERR_NOTSUPP) {
> > fmode &= ~O_EXCL;
> > goto again;
> > }
> > if (newvp)
> > vrele(newvp);
> >
> >
> > This is bad because some programs uses this to do access lock (mail programs
> > comes to mind but there are others), so that the problem in known.
> > At the very last we should log to console a big WARNING here, but IMHO
> > we should just return EOPNOTSUPP.
>
> That seems better. But, is there any standard behavior for this sort
> of thing? Is there any standard that says what an open with O_EXCL can
> or can not return?
Our man page says open() can return EOPNOTSUPP for O_SHLOCK or O_EXLOCK.
BTW, I just checked the NFS specs; they says NFSV3CREATE_EXCLUSIVE may not be
supported by the server. Maybe NFSV3CREATE_GUARDED could be used instead
if NFSV3CREATE_EXCLUSIVE fails with NFSERR_NOTSUPP then ?
From the NFS specs, NFSV3CREATE_GUARDED may fail unders some circunstances
although the file was not present on the server when the call was made,
but should't succeed if the file was already present.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--