Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NFSv3 & O_EXCL

2 views
Skip to first unread message

Manuel Bouyer

unread,
Jul 24, 2000, 3:00:00 AM7/24/00
to
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.

Comments ?

--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel...@lip6.fr
--

Frank van der Linden

unread,
Jul 24, 2000, 3:00:00 AM7/24/00
to
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?

- Frank

Manuel Bouyer

unread,
Jul 25, 2000, 3:00:00 AM7/25/00
to

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.

0 new messages