Subject: Re: Addition to force open to open only regular files
To: None <imp@village.org, greywolf@starwolf.com>
From: Wolfgang Solfrank <ws@tools.de>
List: tech-kern
Date: 11/29/2000 14:48:55
Hi,

> # The race saved by getfh() I think causes kernel resources to be
> # consumed.  The getfh call locks the leaf and leaving it locked on
> # return to userland seems to be dangerous to me.
> 
> ...it locks the leaf?  Really?

getfh() certainly doesn't lock the leaf.  After all, what should unlock it?

Remember that the initial use of getfh() was for the NFS server.  To be
precise, since the NFS server is in the kernel, it doesn't need any
syscall to get to a file handle.  It's for the NFS mount daemon, which
gets requests from some NFS client to return a filehandle for a given
path (after checking permissions, of course) and therefore needs a way
to translate a pathname to a filehandle.

And at that time, getfh() was the only syscall that had anything to do
with filehandles (well, technically, the nfssvc syscall had to do with
filehandles, too, but there the handles were only communicated via
the network, not via the system call).

So there didn't exist any possibility to unlock the leaf after the call
to getfh().  And locking it wouldn't have made any sense in the first
place (NFS is stateless!).

Ciao,
Wolfgang
-- 
ws@TooLs.DE     Wolfgang Solfrank, TooLs GmbH 	+49-228-985800